[hibernate-commits] Hibernate SVN: r10327 - trunk/HibernateExt/ejb/src/java/org/hibernate/ejb

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Wed Aug 23 21:14:26 EDT 2006


Author: epbernard
Date: 2006-08-23 21:14:25 -0400 (Wed, 23 Aug 2006)
New Revision: 10327

Modified:
   trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
Log:
Only serializable entities will be part of the OptimisticLockException

Modified: trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
===================================================================
--- trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java	2006-08-23 22:42:16 UTC (rev 10326)
+++ trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java	2006-08-24 01:14:25 UTC (rev 10327)
@@ -591,7 +591,13 @@
 			if ( e instanceof StaleObjectStateException ) {
 				StaleObjectStateException sose = (StaleObjectStateException) e;
 				Object entity = getRawSession().load( sose.getEntityName(), sose.getIdentifier() );
-				throwPersistenceException( new OptimisticLockException(	null, e, entity ) );
+				if ( entity instanceof Serializable ) {
+					//avoid some user errors regarding boundary crossing
+					throwPersistenceException( new OptimisticLockException(	null, e, entity ) );
+				}
+				else {
+					throwPersistenceException( new OptimisticLockException( e ) );
+				}
 			}
 			else {
 				throwPersistenceException( new OptimisticLockException( e ) );




More information about the hibernate-commits mailing list