[hibernate-commits] Hibernate SVN: r18644 - core/trunk/entitymanager/src/main/java/org/hibernate/ejb.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Wed Jan 27 09:00:57 EST 2010


Author: smarlow at redhat.com
Date: 2010-01-27 09:00:57 -0500 (Wed, 27 Jan 2010)
New Revision: 18644

Modified:
   core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
Log:
HHH-4853  3.4.4.3 Lock Mode Properties and Uses, Vendor-specific hints must be ignored if they are not understood. 

Modified: core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
===================================================================
--- core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java	2010-01-27 09:26:42 UTC (rev 18643)
+++ core/trunk/entitymanager/src/main/java/org/hibernate/ejb/AbstractEntityManagerImpl.java	2010-01-27 14:00:57 UTC (rev 18644)
@@ -191,30 +191,35 @@
 			boolean extended = PessimisticLockScope.EXTENDED.equals( ( PessimisticLockScope ) lockScope );
 			options.setScope( extended );
 		}
-		else {
+		else if ( lockScope != null ) {
 			throw new PersistenceException( "Unable to parse " + AvailableSettings.LOCK_SCOPE + ": " + lockScope );
 		}
 
 		Object lockTimeout = props.get( AvailableSettings.LOCK_TIMEOUT );
-		int timeout;
+		int timeout = 0;
+		boolean timeoutSet = false;
 		if ( lockTimeout instanceof String ) {
 			timeout = Integer.parseInt( ( String ) lockTimeout );
+			timeoutSet = true;
 		}
 		else if ( lockTimeout instanceof Integer ) {
 			timeout = ( Integer ) lockTimeout;
+			timeoutSet = true;
 		}
-		else {
+		else if ( lockTimeout != null ) {
 			throw new PersistenceException( "Unable to parse " + AvailableSettings.LOCK_TIMEOUT + ": " + lockTimeout );
 		}
-		if ( timeout < 0 ) {
-			options.setTimeOut( LockOptions.WAIT_FOREVER );
+		if ( timeoutSet != false ) {
+			if ( timeout < 0 ) {
+				options.setTimeOut( LockOptions.WAIT_FOREVER );
+			}
+			else if ( timeout == 0 ) {
+				options.setTimeOut( LockOptions.NO_WAIT );
+			}
+			else {
+				options.setTimeOut( timeout );
+			}
 		}
-		else if ( timeout == 0 ) {
-			options.setTimeOut( LockOptions.NO_WAIT );
-		}
-		else {
-			options.setTimeOut( timeout );
-		}
 	}
 
 	/**



More information about the hibernate-commits mailing list