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,21 +191,25 @@ 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 ( timeoutSet != false ) {
if ( timeout < 0 ) { if ( timeout < 0 ) {
options.setTimeOut( LockOptions.WAIT_FOREVER ); options.setTimeOut( LockOptions.WAIT_FOREVER );
} }
@ -216,6 +220,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
options.setTimeOut( timeout ); options.setTimeOut( timeout );
} }
} }
}
/** /**
* Sets the default property values for the properties the entity manager supports and which are not already explicitly * Sets the default property values for the properties the entity manager supports and which are not already explicitly