HHH-4853 3.4.4.3 Lock Mode Properties and Uses, Vendor-specific hints must be ignored if they are not understood.

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18644 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Scott Marlow 2010-01-27 14:00:57 +00:00
parent b40cfb58db
commit 75149489d5
1 changed files with 16 additions and 11 deletions

View File

@ -191,29 +191,34 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
boolean extended = PessimisticLockScope.EXTENDED.equals( ( PessimisticLockScope ) lockScope ); boolean extended = PessimisticLockScope.EXTENDED.equals( ( PessimisticLockScope ) lockScope );
options.setScope( extended ); options.setScope( extended );
} }
else { else if ( lockScope != null ) {
throw new PersistenceException( "Unable to parse " + AvailableSettings.LOCK_SCOPE + ": " + lockScope ); throw new PersistenceException( "Unable to parse " + AvailableSettings.LOCK_SCOPE + ": " + lockScope );
} }
Object lockTimeout = props.get( AvailableSettings.LOCK_TIMEOUT ); Object lockTimeout = props.get( AvailableSettings.LOCK_TIMEOUT );
int timeout; int timeout = 0;
boolean timeoutSet = false;
if ( lockTimeout instanceof String ) { if ( lockTimeout instanceof String ) {
timeout = Integer.parseInt( ( String ) lockTimeout ); timeout = Integer.parseInt( ( String ) lockTimeout );
timeoutSet = true;
} }
else if ( lockTimeout instanceof Integer ) { else if ( lockTimeout instanceof Integer ) {
timeout = ( Integer ) lockTimeout; timeout = ( Integer ) lockTimeout;
timeoutSet = true;
} }
else { else if ( lockTimeout != null ) {
throw new PersistenceException( "Unable to parse " + AvailableSettings.LOCK_TIMEOUT + ": " + lockTimeout ); throw new PersistenceException( "Unable to parse " + AvailableSettings.LOCK_TIMEOUT + ": " + lockTimeout );
} }
if ( timeout < 0 ) { if ( timeoutSet != false ) {
options.setTimeOut( LockOptions.WAIT_FOREVER ); if ( timeout < 0 ) {
} options.setTimeOut( LockOptions.WAIT_FOREVER );
else if ( timeout == 0 ) { }
options.setTimeOut( LockOptions.NO_WAIT ); else if ( timeout == 0 ) {
} options.setTimeOut( LockOptions.NO_WAIT );
else { }
options.setTimeOut( timeout ); else {
options.setTimeOut( timeout );
}
} }
} }