Class DefaultReactiveMergeEventListener
java.lang.Object
org.hibernate.reactive.event.impl.DefaultReactiveMergeEventListener
- All Implemented Interfaces:
Serializable,org.hibernate.event.spi.MergeEventListener,org.hibernate.jpa.event.spi.CallbackRegistryConsumer,ReactiveMergeEventListener
public class DefaultReactiveMergeEventListener
extends Object
implements ReactiveMergeEventListener, org.hibernate.event.spi.MergeEventListener
A reactific
DefaultMergeEventListener.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CompletionStage<Void>cascadeAfterSave(org.hibernate.event.spi.EventSource source, org.hibernate.persister.entity.EntityPersister persister, Object entity, org.hibernate.event.spi.MergeContext anything) Cascade behavior is redefined by this subclass, disable superclass behaviorprotected CompletionStage<Void>cascadeBeforeSave(org.hibernate.event.spi.EventSource source, org.hibernate.persister.entity.EntityPersister persister, Object entity, org.hibernate.event.spi.MergeContext anything) Cascade behavior is redefined by this subclass, disable superclass behaviorprotected CompletionStage<Void>cascadeOnMerge(org.hibernate.event.spi.EventSource source, org.hibernate.persister.entity.EntityPersister persister, Object entity, org.hibernate.event.spi.MergeContext copyCache) Perform any cascades needed as part of this copy event.protected CompletionStage<Void>copyValues(org.hibernate.persister.entity.EntityPersister persister, Object entity, Object target, org.hibernate.engine.spi.SessionImplementor source, org.hibernate.event.spi.MergeContext copyCache) protected CompletionStage<Void>copyValues(org.hibernate.persister.entity.EntityPersister persister, Object entity, Object target, org.hibernate.engine.spi.SessionImplementor source, org.hibernate.event.spi.MergeContext copyCache, org.hibernate.type.ForeignKeyDirection foreignKeyDirection) protected CompletionStage<Void>entityIsDetached(org.hibernate.event.spi.MergeEvent event, org.hibernate.event.spi.MergeContext copyCache) protected CompletionStage<Void>entityIsPersistent(org.hibernate.event.spi.MergeEvent event, org.hibernate.event.spi.MergeContext copyCache) protected CompletionStage<Void>entityIsTransient(org.hibernate.event.spi.MergeEvent event, org.hibernate.event.spi.MergeContext copyCache) protected CascadingAction<org.hibernate.event.spi.MergeContext>getMergeMap(org.hibernate.event.spi.MergeContext context) voidinjectCallbackRegistry(org.hibernate.jpa.event.spi.CallbackRegistry callbackRegistry) voidonMerge(org.hibernate.event.spi.MergeEvent event) voidonMerge(org.hibernate.event.spi.MergeEvent event, org.hibernate.event.spi.MergeContext copiedAlready) reactiveOnMerge(org.hibernate.event.spi.MergeEvent event) Handle the given merge event.reactiveOnMerge(org.hibernate.event.spi.MergeEvent event, org.hibernate.event.spi.MergeContext copiedAlready) Handle the given merge event.protected CompletionStage<Void>reactivePerformSave(Object entity, Object id, org.hibernate.persister.entity.EntityPersister persister, boolean useIdentityColumn, org.hibernate.event.spi.MergeContext context, org.hibernate.event.spi.EventSource source, boolean requiresImmediateIdAccess) Prepares the save call by checking the session caches for a pre-existing entity and performing any lifecycle callbacks.protected CompletionStage<Void>reactivePerformSaveOrReplicate(Object entity, org.hibernate.engine.spi.EntityKey key, org.hibernate.persister.entity.EntityPersister persister, boolean useIdentityColumn, org.hibernate.event.spi.MergeContext context, org.hibernate.event.spi.EventSource source, boolean requiresImmediateIdAccess) Performs all the actual work needed to save an entity (well to get the save moved to the execution queue).protected CompletionStage<Void>reactiveSaveWithGeneratedId(Object entity, String entityName, org.hibernate.event.spi.MergeContext context, org.hibernate.event.spi.EventSource source, boolean requiresImmediateIdAccess) Prepares the save call using a newly generated id.protected CompletionStage<Void>reactiveSaveWithRequestedId(Object entity, Object requestedId, String entityName, org.hibernate.event.spi.MergeContext context, org.hibernate.event.spi.EventSource source) Prepares the save call using the given requested id.protected booleansubstituteValuesIfNecessary(Object entity, Object id, Object[] values, org.hibernate.persister.entity.EntityPersister persister, org.hibernate.engine.spi.SessionImplementor source) Perform any property value substitution that is necessary (interceptor callback, version initialization...)protected booleanvisitCollectionsBeforeSave(Object entity, Object id, Object[] values, org.hibernate.type.Type[] types, org.hibernate.event.spi.EventSource source)
-
Constructor Details
-
DefaultReactiveMergeEventListener
public DefaultReactiveMergeEventListener()
-
-
Method Details
-
onMerge
public void onMerge(org.hibernate.event.spi.MergeEvent event) throws org.hibernate.HibernateException - Specified by:
onMergein interfaceorg.hibernate.event.spi.MergeEventListener- Throws:
org.hibernate.HibernateException
-
onMerge
public void onMerge(org.hibernate.event.spi.MergeEvent event, org.hibernate.event.spi.MergeContext copiedAlready) throws org.hibernate.HibernateException - Specified by:
onMergein interfaceorg.hibernate.event.spi.MergeEventListener- Throws:
org.hibernate.HibernateException
-
getMergeMap
-
reactiveOnMerge
public CompletionStage<Void> reactiveOnMerge(org.hibernate.event.spi.MergeEvent event) throws org.hibernate.HibernateException Handle the given merge event.- Specified by:
reactiveOnMergein interfaceReactiveMergeEventListener- Parameters:
event- The merge event to be handled.- Throws:
org.hibernate.HibernateException
-
reactiveOnMerge
public CompletionStage<Void> reactiveOnMerge(org.hibernate.event.spi.MergeEvent event, org.hibernate.event.spi.MergeContext copiedAlready) throws org.hibernate.HibernateException Handle the given merge event.- Specified by:
reactiveOnMergein interfaceReactiveMergeEventListener- Parameters:
event- The merge event to be handled.- Throws:
org.hibernate.HibernateException
-
entityIsPersistent
protected CompletionStage<Void> entityIsPersistent(org.hibernate.event.spi.MergeEvent event, org.hibernate.event.spi.MergeContext copyCache) -
entityIsTransient
protected CompletionStage<Void> entityIsTransient(org.hibernate.event.spi.MergeEvent event, org.hibernate.event.spi.MergeContext copyCache) -
entityIsDetached
protected CompletionStage<Void> entityIsDetached(org.hibernate.event.spi.MergeEvent event, org.hibernate.event.spi.MergeContext copyCache) -
copyValues
protected CompletionStage<Void> copyValues(org.hibernate.persister.entity.EntityPersister persister, Object entity, Object target, org.hibernate.engine.spi.SessionImplementor source, org.hibernate.event.spi.MergeContext copyCache) -
copyValues
protected CompletionStage<Void> copyValues(org.hibernate.persister.entity.EntityPersister persister, Object entity, Object target, org.hibernate.engine.spi.SessionImplementor source, org.hibernate.event.spi.MergeContext copyCache, org.hibernate.type.ForeignKeyDirection foreignKeyDirection) -
cascadeOnMerge
protected CompletionStage<Void> cascadeOnMerge(org.hibernate.event.spi.EventSource source, org.hibernate.persister.entity.EntityPersister persister, Object entity, org.hibernate.event.spi.MergeContext copyCache) Perform any cascades needed as part of this copy event.- Parameters:
source- The merge event being processed.persister- The persister of the entity being copied.entity- The entity being copied.copyCache- A cache of already copied instance.
-
getCascadeReactiveAction
-
cascadeAfterSave
protected CompletionStage<Void> cascadeAfterSave(org.hibernate.event.spi.EventSource source, org.hibernate.persister.entity.EntityPersister persister, Object entity, org.hibernate.event.spi.MergeContext anything) Cascade behavior is redefined by this subclass, disable superclass behavior- Parameters:
source- The session from which the event originated.persister- The entity's persister instance.entity- The entity beng saved.anything- Generally cascade-specific data
-
cascadeBeforeSave
protected CompletionStage<Void> cascadeBeforeSave(org.hibernate.event.spi.EventSource source, org.hibernate.persister.entity.EntityPersister persister, Object entity, org.hibernate.event.spi.MergeContext anything) Cascade behavior is redefined by this subclass, disable superclass behavior- Parameters:
source- The session from which the save event originated.persister- The entity's persister instance.entity- The entity to be saved.anything- Generally cascade-specific data
-
injectCallbackRegistry
public void injectCallbackRegistry(org.hibernate.jpa.event.spi.CallbackRegistry callbackRegistry) - Specified by:
injectCallbackRegistryin interfaceorg.hibernate.jpa.event.spi.CallbackRegistryConsumer
-
reactiveSaveWithRequestedId
protected CompletionStage<Void> reactiveSaveWithRequestedId(Object entity, Object requestedId, String entityName, org.hibernate.event.spi.MergeContext context, org.hibernate.event.spi.EventSource source) Prepares the save call using the given requested id.- Parameters:
entity- The entity to be saved.requestedId- The id to which to associate the entity.entityName- The name of the entity being saved.context- Generally cascade-specific information.source- The session which is the source of this save event.- Returns:
- The id used to save the entity.
-
reactiveSaveWithGeneratedId
protected CompletionStage<Void> reactiveSaveWithGeneratedId(Object entity, String entityName, org.hibernate.event.spi.MergeContext context, org.hibernate.event.spi.EventSource source, boolean requiresImmediateIdAccess) Prepares the save call using a newly generated id.- Parameters:
entity- The entity to be savedentityName- The entity-name for the entity to be savedcontext- Generally cascade-specific information.source- The session which is the source of this save event.requiresImmediateIdAccess- does the event context require access to the identifier immediately after execution of this method (if not, post-insert style id generators may be postponed if we are outside a transaction).- Returns:
- The id used to save the entity; may be null depending on the type of id generator used and the requiresImmediateIdAccess value
-
reactivePerformSave
protected CompletionStage<Void> reactivePerformSave(Object entity, Object id, org.hibernate.persister.entity.EntityPersister persister, boolean useIdentityColumn, org.hibernate.event.spi.MergeContext context, org.hibernate.event.spi.EventSource source, boolean requiresImmediateIdAccess) Prepares the save call by checking the session caches for a pre-existing entity and performing any lifecycle callbacks.- Parameters:
entity- The entity to be saved.id- The id by which to save the entity.persister- The entity's persister instance.useIdentityColumn- Is an identity column being used?context- Generally cascade-specific information.source- The session from which the event originated.requiresImmediateIdAccess- does the event context require access to the identifier immediately after execution of this method (if not, post-insert style id generators may be postponed if we are outside a transaction).- Returns:
- The id used to save the entity; may be null depending on the type of id generator used and the requiresImmediateIdAccess value
-
reactivePerformSaveOrReplicate
protected CompletionStage<Void> reactivePerformSaveOrReplicate(Object entity, org.hibernate.engine.spi.EntityKey key, org.hibernate.persister.entity.EntityPersister persister, boolean useIdentityColumn, org.hibernate.event.spi.MergeContext context, org.hibernate.event.spi.EventSource source, boolean requiresImmediateIdAccess) Performs all the actual work needed to save an entity (well to get the save moved to the execution queue).- Parameters:
entity- The entity to be savedkey- The id to be used for saving the entity (or null, in the case of identity columns)persister- The entity's persister instance.useIdentityColumn- Should an identity column be used for id generation?context- Generally cascade-specific information.source- The session which is the source of the current event.requiresImmediateIdAccess- Is access to the identifier required immediately after the completion of the save? persist(), for example, does not require this...- Returns:
- The id used to save the entity; may be null depending on the type of id generator used and the requiresImmediateIdAccess value
-
substituteValuesIfNecessary
protected boolean substituteValuesIfNecessary(Object entity, Object id, Object[] values, org.hibernate.persister.entity.EntityPersister persister, org.hibernate.engine.spi.SessionImplementor source) Perform any property value substitution that is necessary (interceptor callback, version initialization...)- Parameters:
entity- The entityid- The entity identifiervalues- The snapshot entity statepersister- The entity persistersource- The originating session- Returns:
- True if the snapshot state changed such that reinjection of the values into the entity is required.
-
visitCollectionsBeforeSave
-