[hibernate-commits] Hibernate SVN: r20221 - core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/event/def.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Mon Aug 23 06:52:42 EDT 2010


Author: stliu
Date: 2010-08-23 06:52:41 -0400 (Mon, 23 Aug 2010)
New Revision: 20221

Modified:
   core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/event/def/AbstractSaveEventListener.java
Log:
JBPAPP-4926 HHH-3334 Cascade-save breaks if parent ID is assigned (delays insert) and child has identity ID (early insert)

Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/event/def/AbstractSaveEventListener.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/event/def/AbstractSaveEventListener.java	2010-08-22 16:39:12 UTC (rev 20220)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/event/def/AbstractSaveEventListener.java	2010-08-23 10:52:41 UTC (rev 20221)
@@ -145,7 +145,7 @@
 	}
 
 	/**
-	 * Ppepares the save call by checking the session caches for a pre-existing
+	 * Prepares the save call by checking the session caches for a pre-existing
 	 * entity and performing any lifecycle callbacks.
 	 *
 	 * @param entity The entity to be saved.
@@ -262,11 +262,6 @@
 		boolean inTxn = source.getJDBCContext().isTransactionInProgress();
 		boolean shouldDelayIdentityInserts = !inTxn && !requiresImmediateIdAccess;
 
-		if ( useIdentityColumn && !shouldDelayIdentityInserts ) {
-			log.trace( "executing insertions" );
-			source.getActionQueue().executeInserts();
-		}
-
 		// Put a placeholder in entries, so we don't recurse back and try to save() the
 		// same object again. QUESTION: should this be done before onSave() is called?
 		// likewise, should it be done before onUpdate()?
@@ -285,6 +280,11 @@
 		);
 
 		cascadeBeforeSave( source, persister, entity, anything );
+		
+		if ( useIdentityColumn && !shouldDelayIdentityInserts ) {
+			log.trace( "executing insertions" );
+			source.getActionQueue().executeInserts();
+		}
 
 		Object[] values = persister.getPropertyValuesToInsert( entity, getMergeMap( anything ), source );
 		Type[] types = persister.getPropertyTypes();
@@ -377,7 +377,7 @@
 	}
 
 	/**
-	 * After the save, will te version number be incremented
+	 * After the save, will the version number be incremented
 	 * if the instance is modified?
 	 *
 	 * @return True if the version will be incremented on an entity change after save;
@@ -436,7 +436,7 @@
 	/**
 	 * Handles the calls needed to perform pre-save cascades for the given entity.
 	 *
-	 * @param source The session from whcih the save event originated.
+	 * @param source The session from which the save event originated.
 	 * @param persister The entity's persister instance.
 	 * @param entity The entity to be saved.
 	 * @param anything Generally cascade-specific data
@@ -463,7 +463,7 @@
 	 *
 	 * @param source The session from which the event originated.
 	 * @param persister The entity's persister instance.
-	 * @param entity The entity beng saved.
+	 * @param entity The entity being saved.
 	 * @param anything Generally cascade-specific data
 	 */
 	protected void cascadeAfterSave(



More information about the hibernate-commits mailing list