Class TopiaHibernateEventListener
java.lang.Object
org.nuiton.topia.persistence.internal.support.TopiaHibernateEventListener
- All Implemented Interfaces:
org.hibernate.event.spi.PostDeleteEventListener,org.hibernate.event.spi.PostInsertEventListener,org.hibernate.event.spi.PostLoadEventListener,org.hibernate.event.spi.PostUpdateEventListener,org.hibernate.event.spi.PreDeleteEventListener,org.hibernate.event.spi.PreInsertEventListener,org.hibernate.event.spi.PreLoadEventListener,org.hibernate.event.spi.PreUpdateEventListener,org.hibernate.event.spi.SaveOrUpdateEventListener
public class TopiaHibernateEventListener
extends Object
implements org.hibernate.event.spi.PreInsertEventListener, org.hibernate.event.spi.PostInsertEventListener, org.hibernate.event.spi.PreLoadEventListener, org.hibernate.event.spi.PostLoadEventListener, org.hibernate.event.spi.PreUpdateEventListener, org.hibernate.event.spi.PostUpdateEventListener, org.hibernate.event.spi.PreDeleteEventListener, org.hibernate.event.spi.PostDeleteEventListener, org.hibernate.event.spi.SaveOrUpdateEventListener
- Author:
- Arnaud Thimel (Code Lutin)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidattachContext(Object entity, TopiaDaoSupplier daoSupplier, TopiaFiresSupport firesSupport) Method to enrich an entity if possible with the daoSupplier or firesSupport instancesprotected TopiaPersistenceContextgetContext(org.hibernate.event.spi.AbstractEvent event) Look for the TopiaPersistenceContext based on the given Hibernate sessionvoidonPostDelete(org.hibernate.event.spi.PostDeleteEvent event) voidonPostInsert(org.hibernate.event.spi.PostInsertEvent event) voidonPostLoad(org.hibernate.event.spi.PostLoadEvent event) voidonPostUpdate(org.hibernate.event.spi.PostUpdateEvent event) booleanonPreDelete(org.hibernate.event.spi.PreDeleteEvent event) booleanonPreInsert(org.hibernate.event.spi.PreInsertEvent event) voidonPreLoad(org.hibernate.event.spi.PreLoadEvent event) booleanonPreUpdate(org.hibernate.event.spi.PreUpdateEvent event) voidonSaveOrUpdate(org.hibernate.event.spi.SaveOrUpdateEvent event) booleanrequiresPostCommitHandling(org.hibernate.persister.entity.EntityPersister persister)
-
Field Details
-
registry
-
-
Constructor Details
-
TopiaHibernateEventListener
-
-
Method Details
-
getContext
Look for the TopiaPersistenceContext based on the given Hibernate session- Parameters:
event- the Hibernate event that contains the Session to use- Returns:
- the TopiaPersistenceContext using this Session, or null if not found
-
attachContext
public static void attachContext(Object entity, TopiaDaoSupplier daoSupplier, TopiaFiresSupport firesSupport) Method to enrich an entity if possible with the daoSupplier or firesSupport instances- Parameters:
entity- the entity to enrichdaoSupplier- theTopiaDaoSupplierinstancefiresSupport- theTopiaFiresSupportinstance
-
onPreInsert
public boolean onPreInsert(org.hibernate.event.spi.PreInsertEvent event) - Specified by:
onPreInsertin interfaceorg.hibernate.event.spi.PreInsertEventListener
-
onPostInsert
public void onPostInsert(org.hibernate.event.spi.PostInsertEvent event) - Specified by:
onPostInsertin interfaceorg.hibernate.event.spi.PostInsertEventListener
-
requiresPostCommitHandling
public boolean requiresPostCommitHandling(org.hibernate.persister.entity.EntityPersister persister) -
onPreLoad
public void onPreLoad(org.hibernate.event.spi.PreLoadEvent event) - Specified by:
onPreLoadin interfaceorg.hibernate.event.spi.PreLoadEventListener
-
onPostLoad
public void onPostLoad(org.hibernate.event.spi.PostLoadEvent event) - Specified by:
onPostLoadin interfaceorg.hibernate.event.spi.PostLoadEventListener
-
onPreUpdate
public boolean onPreUpdate(org.hibernate.event.spi.PreUpdateEvent event) - Specified by:
onPreUpdatein interfaceorg.hibernate.event.spi.PreUpdateEventListener
-
onPostUpdate
public void onPostUpdate(org.hibernate.event.spi.PostUpdateEvent event) - Specified by:
onPostUpdatein interfaceorg.hibernate.event.spi.PostUpdateEventListener
-
onPreDelete
public boolean onPreDelete(org.hibernate.event.spi.PreDeleteEvent event) - Specified by:
onPreDeletein interfaceorg.hibernate.event.spi.PreDeleteEventListener
-
onPostDelete
public void onPostDelete(org.hibernate.event.spi.PostDeleteEvent event) - Specified by:
onPostDeletein interfaceorg.hibernate.event.spi.PostDeleteEventListener
-
onSaveOrUpdate
public void onSaveOrUpdate(org.hibernate.event.spi.SaveOrUpdateEvent event) throws org.hibernate.HibernateException - Specified by:
onSaveOrUpdatein interfaceorg.hibernate.event.spi.SaveOrUpdateEventListener- Throws:
org.hibernate.HibernateException
-