[hibernate-commits] Hibernate SVN: r16598 - entitymanager/branches/v3_4_0_GA_CP/src/java/org/hibernate/ejb.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue May 19 09:25:47 EDT 2009


Author: jcosta at redhat.com
Date: 2009-05-19 09:25:47 -0400 (Tue, 19 May 2009)
New Revision: 16598

Modified:
   entitymanager/branches/v3_4_0_GA_CP/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
Log:
JBPAPP-1998 - Backported: Added additional try/catch in AbstractEntityManagerImpl.wrapStaleStateException

Modified: entitymanager/branches/v3_4_0_GA_CP/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
===================================================================
--- entitymanager/branches/v3_4_0_GA_CP/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java	2009-05-19 13:11:42 UTC (rev 16597)
+++ entitymanager/branches/v3_4_0_GA_CP/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java	2009-05-19 13:25:47 UTC (rev 16598)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
 /*
  * JBoss, the OpenSource EJB server Distributable under LGPL license. See terms of license at
  * gnu.org.
@@ -621,12 +621,16 @@
 			StaleObjectStateException sose = (StaleObjectStateException) e;
 			Serializable identifier = sose.getIdentifier();
 			if (identifier != null) {
-				Object entity = getRawSession().load( sose.getEntityName(), identifier );
-				if ( entity instanceof Serializable ) {
-					//avoid some user errors regarding boundary crossing
-					pe = new OptimisticLockException( null, e, entity );
-				}
-				else {
+				try {
+					Object entity = getRawSession().load( sose.getEntityName(), identifier );
+					if ( entity instanceof Serializable ) {
+						//avoid some user errors regarding boundary crossing
+						pe = new OptimisticLockException( null, e, entity );
+					}
+					else {
+						pe = new OptimisticLockException( e );
+					}
+				} catch (EntityNotFoundException enfe) {
 					pe = new OptimisticLockException( e );
 				}
 			}




More information about the hibernate-commits mailing list