activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikmela <mikm...@yahoo.com>
Subject Re: Problem with TransactDatabaseLocker's lock statement
Date Fri, 06 Jul 2012 19:49:42 GMT
Thanks for pointing to this issue.
But the method that overrides lock create statement has a bug... If
isUseLockCreateWhereClause() is true, the produced statement will look
something like this:
*SELECT * FROM ACTIVEMQ_LOCK WHERE ID=1 WITH (UPDLOCK, ROWLOCK)* which will
throw a 
 */com.microsoft.sqlserver.jdbc.SQLServerException: A processing error
"Incorrect syntax near '('." has occurred/*... with MS SQL Server 2008 and
up... I guess it was tested with earlier versions which were more loose in
terms syntax... 
The right way is 
*SELECT * FROM ACTIVEMQ_LOCK WITH (UPDLOCK, ROWLOCK) WHERE ID=1 *

    public void setStatements(Statements statements) {
        String lockCreateStatement = "SELECT * FROM " +
statements.getFullLockTableName();

        if (statements.isUseLockCreateWhereClause()) {
            lockCreateStatement += " WHERE ID = 1";
        }
        lockCreateStatement += " WITH (UPDLOCK, ROWLOCK)";
        statements.setLockCreateStatement(lockCreateStatement);

        super.setStatements(statements);
    }

--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-with-TransactDatabaseLocker-s-lock-statement-tp4653552p4653776.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message