optimistic locking - Hibernate: lockMode for criteria is not working -


i need specify lock mode hibernate. doing:

session().createcriteria(clazz, "c")   .add(restrictions.eq("c.a", false))   .add(subqueries.propertyeq("c.b", subquery))   .setlockmode("pos", lockmode.pessimistic_read); 

but when see provided query - hibernate still doesn't provide select update

how can force hibernate make select update clause? see case when works this:

session().get(clazz, id, lockoptions.upgrade); 

but need use more complex query.

i've found reason why it's wasn't working. it's bug in hibernate 3.5-3.6 , it's fixed in 4.0.1.

https://hibernate.atlassian.net/browse/hhh-5275

so, i've ended workaround:

myobject myobject = criteria.uniqueresult(); myobject lockedone = (myobject) session()                        .get(myobject.class, myobject.getid(), lockmode.upgrade_nowat); 

Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -