Hi all, my problem is I need read and write exclusive lock on a specific record or table. It is a typicall problem of Critical Section. I've been trying all the methods than are specified on Hibernate resources and Hibernate In Action book but I can't get this lock.
If two transaction try to get the same record using the lock mode LockMode.UPGRADE, both of them get the record and I can't isolate the operation, so the second transaction doesn't catch modifications made by first.
Any clues ?
Thanks in advance.
P.S : the operation made using standard JDBC works (select ... for upgrade) so it isn't a DB problem.
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:2.1
Mapping documents:
Code between sessionFactory.openSession() and session.close():
net.sf.hibernate.Transaction tx = session.beginTransaction();
Object obj = session.get(Object.class,id);
session.refresh(obj,LockMode.UPGRADE);
.... several modif over obj ....
session.saveOrUpdate(ide);
tx.commit();
Full stack trace of any exception that occurs:
Name and version of the database you are using:
DB2
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: