Pessimistic locking is not working with Query API

Posted by Reddy on Stack Overflow See other posts from Stack Overflow or by Reddy
Published on 2010-06-16T13:01:55Z Indexed on 2010/06/16 14:02 UTC
Read the original article Hit count: 201

List esns=session.createQuery("from Pool e where e.status=:status "+
                        "order by uuid asc")
                        .setString("status", "AVAILABLE")
                        .setMaxResults(n)
                        .setLockMode("e", LockMode.PESSIMISTIC_WRITE)
                        .list();

I have the above query written, however it is not generating for update query and simultaneous updates are happening.

I am using 3.5.2 version and it has a bug in Criteria API, is the same bug present in query API as well or I am doing something wrong?

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about pessimistic-locking