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:
SELECT... FROM...WHERE... FOR UPDATE
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.
Thanks for the issue! Implemented as suggested.