Hibernate version: 2.1.6
Name and version of the database you are using:postgresql 7.2
Hi,
I noticed that when hibernate loads objects using pessimistic lock as in
Code:
session.load(User.class,userId,LockMode.UPGRADE)
, hibernate loads the object data before locking it. So, hibernate issues 2 SQL statements: the first selects the object data and the second one locks it using something like "select id from user where id = ? for update".
Is this correct? I think session.load() should lock the object before getting its data or else the object may contain stale data. What is your opinion?
Thanks for your help,
Jair