Class CustomFlushEntityEventListener
java.lang.Object
org.hibernate.event.internal.DefaultFlushEntityEventListener
ch.tocco.nice2.persist.core.impl.hibernate.listener.CustomFlushEntityEventListener
- All Implemented Interfaces:
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.-
Constructor Summary
ConstructorsConstructorDescriptionCustomFlushEntityEventListener(AfterCommitListener afterCommitListener, PropertyAccessorService propertyAccessorService) -
Method Summary
Modifier and TypeMethodDescriptionvoidonFlushEntity(org.hibernate.event.spi.FlushEntityEvent event) Methods inherited from class org.hibernate.event.internal.DefaultFlushEntityEventListener
addEntityUpdateActionToActionQueue, checkId, dirtyCheck, handleInterception, injectCallbackRegistry, invokeInterceptor, isUpdateNecessary, throwIdentifiedAlteredException
-
Constructor Details
-
CustomFlushEntityEventListener
public CustomFlushEntityEventListener(AfterCommitListener afterCommitListener, PropertyAccessorService propertyAccessorService)
-
-
Method Details
-
onFlushEntity
public void onFlushEntity(org.hibernate.event.spi.FlushEntityEvent event) throws org.hibernate.HibernateException - Specified by:
onFlushEntityin interfaceorg.hibernate.event.spi.FlushEntityEventListener- Overrides:
onFlushEntityin classorg.hibernate.event.internal.DefaultFlushEntityEventListener- Throws:
org.hibernate.HibernateException
-