Class DefaultReactivePersistEventListener

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.concurrent.CompletionStage<java.lang.Void> cascadeAfterSave​(org.hibernate.event.spi.EventSource source, org.hibernate.persister.entity.EntityPersister persister, java.lang.Object entity, C context)
      Handles to calls needed to perform post-save cascades.
      protected java.util.concurrent.CompletionStage<java.lang.Void> cascadeBeforeSave​(org.hibernate.event.spi.EventSource source, org.hibernate.persister.entity.EntityPersister persister, java.lang.Object entity, C context)
      Handles the calls needed to perform pre-save cascades for the given entity.
      protected java.util.concurrent.CompletionStage<java.lang.Void> entityIsPersistent​(org.hibernate.event.spi.PersistEvent event, org.hibernate.event.spi.PersistContext createCache)  
      protected java.util.concurrent.CompletionStage<java.lang.Void> entityIsTransient​(org.hibernate.event.spi.PersistEvent event, org.hibernate.event.spi.PersistContext createCache)
      Handle the given create event.
      protected CascadingAction<org.hibernate.event.spi.PersistContext> getCascadeReactiveAction()  
      protected java.util.Map<java.lang.Object,​java.lang.Object> getMergeMap​(C anything)  
      void injectCallbackRegistry​(org.hibernate.jpa.event.spi.CallbackRegistry callbackRegistry)  
      void onPersist​(org.hibernate.event.spi.PersistEvent event)  
      void onPersist​(org.hibernate.event.spi.PersistEvent event, org.hibernate.event.spi.PersistContext createdAlready)  
      java.util.concurrent.CompletionStage<java.lang.Void> reactiveOnPersist​(org.hibernate.event.spi.PersistEvent event)
      Handle the given create event.
      java.util.concurrent.CompletionStage<java.lang.Void> reactiveOnPersist​(org.hibernate.event.spi.PersistEvent event, org.hibernate.event.spi.PersistContext createCache)
      Handle the given create event.
      protected java.util.concurrent.CompletionStage<java.lang.Void> reactivePerformSave​(java.lang.Object entity, java.lang.Object id, org.hibernate.persister.entity.EntityPersister persister, boolean useIdentityColumn, C 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 java.util.concurrent.CompletionStage<java.lang.Void> reactivePerformSaveOrReplicate​(java.lang.Object entity, org.hibernate.engine.spi.EntityKey key, org.hibernate.persister.entity.EntityPersister persister, boolean useIdentityColumn, C 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 java.util.concurrent.CompletionStage<java.lang.Void> reactiveSaveWithGeneratedId​(java.lang.Object entity, java.lang.String entityName, C context, org.hibernate.event.spi.EventSource source, boolean requiresImmediateIdAccess)
      Prepares the save call using a newly generated id.
      protected java.util.concurrent.CompletionStage<java.lang.Void> reactiveSaveWithRequestedId​(java.lang.Object entity, java.lang.Object requestedId, java.lang.String entityName, C context, org.hibernate.event.spi.EventSource source)
      Prepares the save call using the given requested id.
      protected boolean substituteValuesIfNecessary​(java.lang.Object entity, java.lang.Object id, java.lang.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 boolean visitCollectionsBeforeSave​(java.lang.Object entity, java.lang.Object id, java.lang.Object[] values, org.hibernate.type.Type[] types, org.hibernate.event.spi.EventSource source)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.hibernate.jpa.event.spi.CallbackRegistryConsumer

        injectCallbackRegistry
    • Constructor Detail

      • DefaultReactivePersistEventListener

        public DefaultReactivePersistEventListener()
    • Method Detail

      • getCascadeReactiveAction

        protected CascadingAction<org.hibernate.event.spi.PersistContext> getCascadeReactiveAction()
      • onPersist

        public void onPersist​(org.hibernate.event.spi.PersistEvent event)
                       throws org.hibernate.HibernateException
        Specified by:
        onPersist in interface org.hibernate.event.spi.PersistEventListener
        Throws:
        org.hibernate.HibernateException
      • reactiveOnPersist

        public java.util.concurrent.CompletionStage<java.lang.Void> reactiveOnPersist​(org.hibernate.event.spi.PersistEvent event)
        Handle the given create event.
        Specified by:
        reactiveOnPersist in interface ReactivePersistEventListener
        Parameters:
        event - The create event to be handled.
      • onPersist

        public void onPersist​(org.hibernate.event.spi.PersistEvent event,
                              org.hibernate.event.spi.PersistContext createdAlready)
                       throws org.hibernate.HibernateException
        Specified by:
        onPersist in interface org.hibernate.event.spi.PersistEventListener
        Throws:
        org.hibernate.HibernateException
      • reactiveOnPersist

        public java.util.concurrent.CompletionStage<java.lang.Void> reactiveOnPersist​(org.hibernate.event.spi.PersistEvent event,
                                                                                      org.hibernate.event.spi.PersistContext createCache)
        Handle the given create event.
        Specified by:
        reactiveOnPersist in interface ReactivePersistEventListener
        Parameters:
        event - The create event to be handled.
      • entityIsPersistent

        protected java.util.concurrent.CompletionStage<java.lang.Void> entityIsPersistent​(org.hibernate.event.spi.PersistEvent event,
                                                                                          org.hibernate.event.spi.PersistContext createCache)
      • entityIsTransient

        protected java.util.concurrent.CompletionStage<java.lang.Void> entityIsTransient​(org.hibernate.event.spi.PersistEvent event,
                                                                                         org.hibernate.event.spi.PersistContext createCache)
        Handle the given create event.
        Parameters:
        event - The save event to be handled.
        createCache - The copy cache of entity instance to merge/copy instance.
      • injectCallbackRegistry

        public void injectCallbackRegistry​(org.hibernate.jpa.event.spi.CallbackRegistry callbackRegistry)
        Specified by:
        injectCallbackRegistry in interface org.hibernate.jpa.event.spi.CallbackRegistryConsumer
      • reactiveSaveWithRequestedId

        protected java.util.concurrent.CompletionStage<java.lang.Void> reactiveSaveWithRequestedId​(java.lang.Object entity,
                                                                                                   java.lang.Object requestedId,
                                                                                                   java.lang.String entityName,
                                                                                                   C 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 java.util.concurrent.CompletionStage<java.lang.Void> reactiveSaveWithGeneratedId​(java.lang.Object entity,
                                                                                                   java.lang.String entityName,
                                                                                                   C context,
                                                                                                   org.hibernate.event.spi.EventSource source,
                                                                                                   boolean requiresImmediateIdAccess)
        Prepares the save call using a newly generated id.
        Parameters:
        entity - The entity to be saved
        entityName - The entity-name for the entity to be saved
        context - 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 java.util.concurrent.CompletionStage<java.lang.Void> reactivePerformSave​(java.lang.Object entity,
                                                                                           java.lang.Object id,
                                                                                           org.hibernate.persister.entity.EntityPersister persister,
                                                                                           boolean useIdentityColumn,
                                                                                           C 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 java.util.concurrent.CompletionStage<java.lang.Void> reactivePerformSaveOrReplicate​(java.lang.Object entity,
                                                                                                      org.hibernate.engine.spi.EntityKey key,
                                                                                                      org.hibernate.persister.entity.EntityPersister persister,
                                                                                                      boolean useIdentityColumn,
                                                                                                      C 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 saved
        key - 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
      • getMergeMap

        protected java.util.Map<java.lang.Object,​java.lang.Object> getMergeMap​(C anything)
      • cascadeBeforeSave

        protected java.util.concurrent.CompletionStage<java.lang.Void> cascadeBeforeSave​(org.hibernate.event.spi.EventSource source,
                                                                                         org.hibernate.persister.entity.EntityPersister persister,
                                                                                         java.lang.Object entity,
                                                                                         C context)
        Handles the calls needed to perform pre-save cascades for the given entity.
        Parameters:
        source - The session from which the save event originated.
        persister - The entity's persister instance.
        entity - The entity to be saved.
        context - Generally cascade-specific data
      • cascadeAfterSave

        protected java.util.concurrent.CompletionStage<java.lang.Void> cascadeAfterSave​(org.hibernate.event.spi.EventSource source,
                                                                                        org.hibernate.persister.entity.EntityPersister persister,
                                                                                        java.lang.Object entity,
                                                                                        C context)
        Handles to calls needed to perform post-save cascades.
        Parameters:
        source - The session from which the event originated.
        persister - The entity's persister instance.
        entity - The entity beng saved.
        context - Generally cascade-specific data
      • substituteValuesIfNecessary

        protected boolean substituteValuesIfNecessary​(java.lang.Object entity,
                                                      java.lang.Object id,
                                                      java.lang.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 entity
        id - The entity identifier
        values - The snapshot entity state
        persister - The entity persister
        source - The originating session
        Returns:
        True if the snapshot state changed such that reinjection of the values into the entity is required.
      • visitCollectionsBeforeSave

        protected boolean visitCollectionsBeforeSave​(java.lang.Object entity,
                                                     java.lang.Object id,
                                                     java.lang.Object[] values,
                                                     org.hibernate.type.Type[] types,
                                                     org.hibernate.event.spi.EventSource source)