[hibernate-dev] Should EntityManager#refresh retain an existing lock?

Steve Ebersole steve at hibernate.org
Wed Jan 31 17:38:05 EST 2018


>
> It is possible to call EntityManager#lock(Object entity, LockModeType
> lockMode) with a lower-level lock, but that request will be ignored.
> Hibernate will only upgrade a lock.
>

Sure, this is in keeping with most (all?) databases - a transaction can
only acquire more restrictive locks.



> I think that clarifies retaining the same lock-level for the entity when
> calling EntityManager#refresh(Object entity).
>
> If no one has any comments that disagree with this in the next couple of
> days, I'll go with that.
>

That's the correct handling.


More information about the hibernate-dev mailing list