Bind Hibernate Core deprecated lock modes for completeness and map UPGRADE_NOWAIT like PESSIMISTIC_WRITE with a timeout of 0

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18162 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Emmanuel Bernard 2009-12-08 16:01:36 +00:00
parent e71c0e4ba4
commit c7149b0da4
1 changed files with 6 additions and 2 deletions

View File

@ -570,9 +570,13 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
return LockModeType.OPTIMISTIC_FORCE_INCREMENT;
else if ( lockMode == LockMode.PESSIMISTIC_READ )
return LockModeType.PESSIMISTIC_READ;
else if ( lockMode == LockMode.PESSIMISTIC_WRITE )
else if ( lockMode == LockMode.PESSIMISTIC_WRITE
|| lockMode == LockMode.UPGRADE
|| lockMode == LockMode.UPGRADE_NOWAIT) //timeout of 0
//TODO check that if we have UPGRADE_NOWAIT we have a timeout of zero?
return LockModeType.PESSIMISTIC_WRITE;
else if ( lockMode == LockMode.PESSIMISTIC_FORCE_INCREMENT )
else if ( lockMode == LockMode.PESSIMISTIC_FORCE_INCREMENT
|| lockMode == LockMode.FORCE)
return LockModeType.PESSIMISTIC_FORCE_INCREMENT;
throw new AssertionFailure("unhandled lock mode " + lockMode );
}