Details
Description
I have an application that runs fine on SQL Server 2000. When I try to run it on SQL Server 2005 Express the following Exception is thrown:
org.exolab.castor.jdo.PersistenceException: SQL exception in the key generator
org.exolab.castor.jdo.keygen.HighLowKeyGenerator: java.sql.SQLException: Incorrect syntax near 'holdlock'.
If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server
Books Online for proper syntax..: Incorrect syntax near 'holdlock'. If this is intended as a part of a table hint, A
WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax.
at org.exolab.castor.jdo.keygen.HighLowKeyGenerator.generateKey(HighLowKeyGenerator.java:361)
at org.exolab.castor.jdo.engine.SQLStatementCreate.generateKey(SQLStatementCreate.java:392)
at org.exolab.castor.jdo.engine.SQLStatementCreate.executeStatement(SQLStatementCreate.java:193)
at org.exolab.castor.jdo.engine.SQLEngine.create(SQLEngine.java:314)
at org.exolab.castor.persist.ClassMolder.create(ClassMolder.java:691)
at org.exolab.castor.persist.LockEngine.create(LockEngine.java:547)
at org.castor.persist.AbstractTransactionContext.walkObjectsToBeCreated(AbstractTransactionContext.java:816)
at org.castor.persist.AbstractTransactionContext.create(AbstractTransactionContext.java:776)
at org.exolab.castor.jdo.engine.AbstractDatabaseImpl.create(AbstractDatabaseImpl.java:313)
Attachments
Issue Links
| This issue relates to: | ||||
| CASTOR-2477 | Let KeyGenerator taken over role of SQLSatementCreate |
|
|
|
Searching online docs of SQL server 2005 I found that the syntax should be 'WITH (HOLDLOCK)'. The problem is that I could not find out if this syntax will also work with older versions of SQL server. In addition I found a remark that the HOLDLOCK and SERIALIZABLE hints may be removed in future versions of SQL server but they didn't suggest an alternative.
See:
http://technet.microsoft.com/de-de/library/ms174335.aspx
http://technet.microsoft.com/de-de/library/ms187373.aspx
Brian, are you able to help me with the open questions.
Having said that I will also need your help for testing as I do not have access to SQL server.