1
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?

Community
  • 1
  • 1
Reddy
  • 8,737
  • 11
  • 55
  • 73

2 Answers2

3

setLockOptions is working fine. It is the same bug as this one.

Reddy
  • 8,737
  • 11
  • 55
  • 73
1

Try to use LockModeType.PESSIMISTIC_FORCE_INCREMENT, take a look at this solution.

Community
  • 1
  • 1
Ricardo Vila
  • 1,626
  • 1
  • 18
  • 34