Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
sqlQuery.forUpdate() does not work on SQLServer #1446
In case we have an SQLQuery and call query.forUpdate(), that does not work on SQLServer.
The reason is that while all other databases use the syntax:
SQLServer uses the following:
SELECT ... FROM ... WITH (UPDLOCK) ... WHERE...
That means that pessimistic lock can be done with a Table Hint in SQLServer.
There is a class called SQLServerQuery and the hint can be added easily there. However, by using that class, the code will be database dependent.
It would be nice if sqlQuery.forUpdate() added a table hint instead of QueryFlag in case of SQLServer so the client code could be database independent.