Hi,
I faced with inconsistency. I open transaction and select object with Session.get(id, LockMode.PESSIMISTIC_WRITE). Hibernate picks from loader map EntityLoader object. It doesn't override method applyLocksToSql defined in base class Loader.
The default implementation of the method just returns its argument.
Therefore Dialect.getForUpdateString is not called.
If I use Session.list then all right because this method uses another loader - CriteriaLoader.
Session.load is the same to get.
I don't think that it's a bug because I have hibernate 3.6.1.Final and I don't do any extra specific actions.
Please, answer why has been such decision done and what should I do when I want pick locked object by its id? Why does Session.get take lock mode argument and don't use it?
Daneel Yaitskov
|