Class PersistenceEventInterceptor
java.lang.Object
org.hibernate.EmptyInterceptor
org.openremote.container.persistence.PersistenceEventInterceptor
- All Implemented Interfaces:
Serializable,org.hibernate.Interceptor
public class PersistenceEventInterceptor
extends org.hibernate.EmptyInterceptor
Intercept Hibernate lifecycle events and publish a message.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Consumer<org.openremote.model.PersistenceEvent<?>>protected Set<org.openremote.model.PersistenceEvent<?>>Fields inherited from class org.hibernate.EmptyInterceptor
INSTANCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterTransactionBegin(org.hibernate.Transaction tx) voidafterTransactionCompletion(org.hibernate.Transaction tx) voidonDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) booleanonFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, org.hibernate.type.Type[] types) booleanonSave(Object entity, Serializable id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) voidsetEventConsumer(Consumer<org.openremote.model.PersistenceEvent<?>> eventConsumer) Methods inherited from class org.hibernate.EmptyInterceptor
beforeTransactionCompletion, findDirty, getEntity, getEntityName, instantiate, isTransient, onCollectionRecreate, onCollectionRemove, onCollectionUpdate, onLoad, onPrepareStatement, postFlush, preFlush
-
Field Details
-
eventConsumer
-
persistenceEvents
-
-
Constructor Details
-
PersistenceEventInterceptor
public PersistenceEventInterceptor()
-
-
Method Details
-
setEventConsumer
-
onSave
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) throws org.hibernate.CallbackException - Specified by:
onSavein interfaceorg.hibernate.Interceptor- Overrides:
onSavein classorg.hibernate.EmptyInterceptor- Throws:
org.hibernate.CallbackException
-
onFlushDirty
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, org.hibernate.type.Type[] types) throws org.hibernate.CallbackException - Specified by:
onFlushDirtyin interfaceorg.hibernate.Interceptor- Overrides:
onFlushDirtyin classorg.hibernate.EmptyInterceptor- Throws:
org.hibernate.CallbackException
-
onDelete
public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) - Specified by:
onDeletein interfaceorg.hibernate.Interceptor- Overrides:
onDeletein classorg.hibernate.EmptyInterceptor
-
afterTransactionBegin
public void afterTransactionBegin(org.hibernate.Transaction tx) - Specified by:
afterTransactionBeginin interfaceorg.hibernate.Interceptor- Overrides:
afterTransactionBeginin classorg.hibernate.EmptyInterceptor
-
afterTransactionCompletion
public void afterTransactionCompletion(org.hibernate.Transaction tx) - Specified by:
afterTransactionCompletionin interfaceorg.hibernate.Interceptor- Overrides:
afterTransactionCompletionin classorg.hibernate.EmptyInterceptor
-