Class CustomFlushEntityEventListener

java.lang.Object
org.hibernate.event.internal.DefaultFlushEntityEventListener
ch.tocco.nice2.persist.core.impl.hibernate.listener.CustomFlushEntityEventListener
All Implemented Interfaces:
Serializable, org.hibernate.event.spi.FlushEntityEventListener, org.hibernate.jpa.event.spi.CallbackRegistryConsumer

public class CustomFlushEntityEventListener extends org.hibernate.event.internal.DefaultFlushEntityEventListener
This is a workaround for firing after commit events (EntityListener) when only the collection of an entity has changed. Hibernate does not fire a EventType.POST_COMMIT_UPDATE event when only the (non-owning side) of a relation is changed (because no change is required for this entity on the database for this table). In this listener we check if this is the case and fire the event manually through the AfterCommitListener.
See Also:
  • Constructor Details

  • Method Details

    • onFlushEntity

      public void onFlushEntity(org.hibernate.event.spi.FlushEntityEvent event) throws org.hibernate.HibernateException
      Specified by:
      onFlushEntity in interface org.hibernate.event.spi.FlushEntityEventListener
      Overrides:
      onFlushEntity in class org.hibernate.event.internal.DefaultFlushEntityEventListener
      Throws:
      org.hibernate.HibernateException