Dear all,
I have a question about "setLockMode" for Query
some codes as following....
===================================
Transaction tx= session.beginTransaction();
Query q = session.createQuery(" from Add as addr");
q.setLockMode("addr", LockMode.UPGRADE);
result = q.list();
......
tx.commit()
......
===================================
logically,
When the code "q.list()" is executed, hibernate will connect to the database(DB2) and fetch records using "select ... for update"
and, all records will be locked.
But I failed....
I set "q.list()" as a breakpoint.
concurrently,
run a prog to update(or insert) data
It still works.... (shock)
anybody can tell me what's wrong.....
|