[hibernate-dev] JPA2 locking

Steve Ebersole steve at hibernate.org
Tue Oct 20 14:22:54 EDT 2009

On Tue, 2009-10-20 at 14:12 -0400, Scott Marlow wrote:
> On 10/20/2009 12:16 PM, Steve Ebersole wrote:
> > See my reading of P2 though is more than just ensuring a repeatable
> > read.
> >
> > If T1 does lock(entity, LockModeType.PESSIMISTIC_READ) we need to make
> > sure T2 cannot update or delete that row b4 T1 completes.  That's
> > blocking, not simply repeatable read.
> >    
> I guess we get into how repeatable read isolation level is implemented 
> and whether it could be implemented without at least a read lock on the 
> database table row.  Or did you mean something else?
That's true.  And actually the dialects have a method to help with this:
Dialect#doesRepeatableReadCauseReadersToBlockWriters :)

There is also, Dialect#doesReadCommittedCauseWritersToBlockReaders

Steve Ebersole <steve at hibernate.org>

More information about the hibernate-dev mailing list