4343import static org .hibernate .pretty .MessageHelper .infoString ;
4444
4545/**
46- * A convenience base class for listeners responding to save events.
46+ * A convenience base class for listeners responding to persist or merge events.
47+ * <p>
48+ * This class contains common functionality for persisting new transient instances.
4749 *
4850 * @author Steve Ebersole.
4951 */
@@ -58,13 +60,13 @@ public void injectCallbackRegistry(CallbackRegistry callbackRegistry) {
5860 }
5961
6062 /**
61- * Prepares the save call using the given requested id.
63+ * Prepares the persist call using the given requested id.
6264 *
63- * @param entity The entity to be saved.
64- * @param requestedId The id to which to associate the entity.
65- * @param entityName The name of the entity being saved.
66- * @param context Generally cascade-specific information.
67- * @param source The session which is the source of this save event.
65+ * @param entity The entity to be persisted
66+ * @param requestedId The id with which to associate the entity
67+ * @param entityName The name of the entity being persisted
68+ * @param context Generally cascade-specific information
69+ * @param source The session which is the source of this event
6870 *
6971 * @return The id used to save the entity.
7072 */
@@ -79,18 +81,18 @@ protected Object saveWithRequestedId(
7981 }
8082
8183 /**
82- * Prepares the save call using a newly generated id.
84+ * Prepares the persist call using a newly generated id.
8385 *
84- * @param entity The entity to be saved
85- * @param entityName The entity-name for the entity to be saved
86- * @param context Generally cascade-specific information.
87- * @param source The session which is the source of this save event.
86+ * @param entity The entity to be persisted
87+ * @param entityName The entity-name for the entity to be persisted
88+ * @param context Generally cascade-specific information
89+ * @param source The session which is the source of this persist event
8890 * @param requiresImmediateIdAccess does the event context require
8991 * access to the identifier immediately after execution of this method
9092 * (if not, post-insert style id generators may be postponed if we are
9193 * outside a transaction).
9294 *
93- * @return The id used to save the entity; may be null depending on the
95+ * @return The id used to persist the entity; may be null depending on the
9496 * type of id generator used and the requiresImmediateIdAccess value
9597 */
9698 protected Object saveWithGeneratedId (
@@ -140,10 +142,10 @@ else if ( generatedBeforeExecution ) {
140142 * Generate an id before execution of the insert statements,
141143 * using the given {@link BeforeExecutionGenerator}.
142144 *
143- * @param entity The entity instance to be saved
144- * @param source The session which is the source of this save event.
145- * @param generator The entity's generator
146- * @param persister The entity's persister instance.
145+ * @param entity The entity instance to be persisted
146+ * @param source The session which is the source of this persist event
147+ * @param generator The generator for the entity id
148+ * @param persister The persister for the entity
147149 *
148150 * @return The generated id
149151 */
@@ -158,7 +160,7 @@ private static Object generateId(
158160 throw new IdentifierGenerationException ( "Null id generated for entity '" + persister .getEntityName () + "'" );
159161 }
160162 else {
161- if ( LOG .isDebugEnabled () ) {
163+ if ( LOG .isTraceEnabled () ) {
162164 // TODO: define toString()s for generators
163165 LOG .tracef (
164166 "Generated identifier [%s] using generator '%s'" ,
@@ -171,18 +173,18 @@ private static Object generateId(
171173 }
172174
173175 /**
174- * Prepares the save call by checking the session caches for a pre-existing
176+ * Prepares the persist call by checking the session caches for a pre-existing
175177 * entity and performing any lifecycle callbacks.
176178 *
177- * @param entity The entity to be saved.
178- * @param id The id by which to save the entity.
179- * @param persister The entity's persister instance.
179+ * @param entity The entity to be persisted
180+ * @param id The id by which to persist the entity
181+ * @param persister The entity's persister instance
180182 * @param useIdentityColumn Is an identity column being used?
181- * @param context Generally cascade-specific information.
182- * @param source The session from which the event originated.
183+ * @param context Generally cascade-specific information
184+ * @param source The session from which the event originated
183185 * @param delayIdentityInserts Should the identity insert be delayed?
184186 *
185- * @return The id used to save the entity; may be null depending on the
187+ * @return The id used to persist the entity; may be null depending on the
186188 * type of id generator used and on delayIdentityInserts
187189 */
188190 protected Object performSave (
@@ -211,7 +213,7 @@ protected Object performSave(
211213 }
212214
213215 if ( LOG .isTraceEnabled () ) {
214- LOG .trace ( "Saving " + infoString ( persister , id , source .getFactory () ) );
216+ LOG .trace ( "Persisting " + infoString ( persister , id , source .getFactory () ) );
215217 }
216218
217219 final EntityKey key = useIdentityColumn ? null : entityKey ( id , persister , source );
@@ -237,18 +239,18 @@ else if ( persistenceContext.containsDeletedUnloadedEntityKey( key ) ) {
237239 }
238240
239241 /**
240- * Performs all the actual work needed to save an entity (well to get the save moved to
241- * the execution queue).
242+ * Performs all the actual work needed to persist an entity
243+ * (well to get the persist action moved to the execution queue).
242244 *
243- * @param entity The entity to be saved
245+ * @param entity The entity to be persisted
244246 * @param key The id to be used for saving the entity (or null, in the case of identity columns)
245- * @param persister The entity's persister instance.
247+ * @param persister The persister for the entity
246248 * @param useIdentityColumn Should an identity column be used for id generation?
247- * @param context Generally cascade-specific information.
248- * @param source The session which is the source of the current event.
249+ * @param context Generally cascade-specific information
250+ * @param source The session which is the source of the current event
249251 * @param delayIdentityInserts Should the identity insert be delayed?
250252 *
251- * @return The id used to save the entity; may be null depending on the
253+ * @return The id used to persist the entity; may be null depending on the
252254 * type of id generator used and the requiresImmediateIdAccess value
253255 */
254256 protected Object performSaveOrReplicate (
@@ -394,10 +396,10 @@ protected Map<Object,Object> getMergeMap(C anything) {
394396 }
395397
396398 /**
397- * After the save , will the version number be incremented
399+ * After the persist , will the version number be incremented
398400 * if the instance is modified?
399401 *
400- * @return True if the version will be incremented on an entity change after save ;
402+ * @return True if the version will be incremented on an entity change after persist ;
401403 * false otherwise.
402404 */
403405 protected boolean isVersionIncrementDisabled () {
@@ -451,11 +453,11 @@ protected boolean substituteValuesIfNecessary(
451453 }
452454
453455 /**
454- * Handles the calls needed to perform pre-save cascades for the given entity.
456+ * Handles the calls needed to perform pre-persist cascades for the given entity.
455457 *
456- * @param source The session from which the save event originated.
457- * @param persister The entity's persister instance.
458- * @param entity The entity to be saved.
458+ * @param source The session from which the persist event originated
459+ * @param persister The persister for the entity
460+ * @param entity The entity to be persisted
459461 * @param context Generally cascade-specific data
460462 */
461463 protected void cascadeBeforeSave (
@@ -482,11 +484,11 @@ protected void cascadeBeforeSave(
482484 }
483485
484486 /**
485- * Handles calls needed to perform post-save cascades.
487+ * Handles calls needed to perform post-persist cascades.
486488 *
487- * @param source The session from which the event originated.
488- * @param persister The entity's persister instance.
489- * @param entity The entity being saved.
489+ * @param source The session from which the event originated
490+ * @param persister The persister for the entity
491+ * @param entity The entity being persisted
490492 * @param context Generally cascade-specific data
491493 */
492494 protected void cascadeAfterSave (
0 commit comments