I’ve come up with a fix for people who are not using identities in SQL server, but want oracle-style sequencing on multi-app server environments. I’m not sure what the procedure is to put this into the OJB code base, so I’ll just post the files here. This is in response to problems using SequenceManagerHighLowImpl on SQL Server, because SQL server doesn’t support read locking. The result in a multi-app server environment is quite disastrous – it will give out duplicated keys, which then in turn over-write newly inserted records with updates.

 

This solution uses a stored procedure which can give out a new sequence and update the table in one call, so there are no read-locking issues (SQL server doesn’t really support read locking, or select for update, etc). I’ve also made a new sequence generator class (I couldn’t put everything I needed into the platform file, since I needed to get the max_key value before creating a new sequence.). This solution will give those seeking an oracle-style sequence generator a final answer (Identity columns really suck). Also is an updated platform file that builds the sql to call the stored procedure. I’ve tested pushing over 50,000 records through this code with no problems. I’ve tested this against v0.0.9, and currently it only supports a grab size of 1.

 

Credit goes out to our dba Jean Macnutt for writing the stored procedure.

 

 

Happy sequencing,

 

Ryan Vanderwerf

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to