I am a bit confused as to how hibernate implements pessismistic locking for the EntityManager?
I have a written a simple tests which spawns two threads, the first thread calls EntityManager.lock(theEntity, LockModeType.WRITE);
The second thread seems to hand indefinetly when it accesses the same entity, even when the first thread has finished and closes the entity manager it uses?
I also notice that the JPA does not specify how pessimistic locking should be implemented it leaves it up to the vendor.
So what does hibernate do?
|