castor

HighLowKeyGenerator throws an Exception on SQL Server 2005

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1.2.1
  • Fix Version/s: 1.3.1
  • Component/s: JDO
  • Labels:
    None
  • Environment:
    Windows XP, SQL Server 2005 Express, Java 1.6.0_03, jTDS 1.2 (JDBC Driver)
  • Number of attachments :
    1

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)

Issue Links

Activity

Hide
Ralf Joachim added a comment -

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.

Show
Ralf Joachim added a comment - 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.
Hide
Brian Schlining added a comment -

Ralf,

Yes I can help with the SQL Server testing. If you happen to have examples of the SQL being executed, could you send them to me? If not let me know and I'll dig through the code to piece it together and run the 2 different SQL calls on both SQL 2000 and 2005.

Show
Brian Schlining added a comment - Ralf, Yes I can help with the SQL Server testing. If you happen to have examples of the SQL being executed, could you send them to me? If not let me know and I'll dig through the code to piece it together and run the 2 different SQL calls on both SQL 2000 and 2005.
Hide
Ralf Joachim added a comment -

Will try to post an example SQL statement for you to test.

Show
Ralf Joachim added a comment - Will try to post an example SQL statement for you to test.
Hide
Ralf Joachim added a comment -

Working at CASTOR-2631 Udai recognized that TEST972 of new cpactf seams to be failing according to this issue. The error message is:

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. while executing SELECT

Test is excluded at the moment and should be enabled when this issue got resolved.

Show
Ralf Joachim added a comment - Working at CASTOR-2631 Udai recognized that TEST972 of new cpactf seams to be failing according to this issue. The error message is:
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. while executing SELECT
Test is excluded at the moment and should be enabled when this issue got resolved.
Hide
Udai Gupta added a comment -

There are two tests which are failing due this issue

  • TEST972
  • TEST1379
    I will exclude SQL_SERVER engine from these tests until this issue get resolved.
Show
Udai Gupta added a comment - There are two tests which are failing due this issue
  • TEST972
  • TEST1379 I will exclude SQL_SERVER engine from these tests until this issue get resolved.
Hide
Ralf Joachim added a comment -

This have to be fixed in SQLServerQueryExpression.getStatement().

Show
Ralf Joachim added a comment - This have to be fixed in SQLServerQueryExpression.getStatement().
Hide
Udai Gupta added a comment -

The above two tests don't give 'holdlock' error after the patch.

Show
Udai Gupta added a comment - The above two tests don't give 'holdlock' error after the patch.
Hide
Ralf Joachim added a comment -

Thanks for the patch and for testing things but I have to reopen the issue as the changes have to be committed before we set the issue to resolved.

Show
Ralf Joachim added a comment - Thanks for the patch and for testing things but I have to reopen the issue as the changes have to be committed before we set the issue to resolved.
Hide
Ralf Joachim added a comment -

One more question. Why does the patch not enable test972 and test1379 if they work now?

Show
Ralf Joachim added a comment - One more question. Why does the patch not enable test972 and test1379 if they work now?
Hide
Udai Gupta added a comment -

I haven't enabled them because those are facing CASTOR-2648 issue. I will make them enable in CASTOR-2648 patch.

Show
Udai Gupta added a comment - I haven't enabled them because those are facing CASTOR-2648 issue. I will make them enable in CASTOR-2648 patch.
Hide
Ralf Joachim added a comment -

That's what I feared.

Show
Ralf Joachim added a comment - That's what I feared.
Hide
Ralf Joachim added a comment -

Commited patch as is after adding release notes.

Show
Ralf Joachim added a comment - Commited patch as is after adding release notes.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: