Class PersistenceEventInterceptor
java.lang.Object
org.openremote.container.persistence.PersistenceEventInterceptor
- All Implemented Interfaces:
org.hibernate.Interceptor
Intercept Hibernate lifecycle events and publish a message.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterTransactionBegin
(org.hibernate.Transaction tx) void
onDelete
(Object entity, Object id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) boolean
onFlushDirty
(Object entity, Object id, Object[] currentState, Object[] previousState, String[] propertyNames, org.hibernate.type.Type[] types) boolean
onSave
(Object entity, Object id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) void
setEventConsumer
(Consumer<org.openremote.model.PersistenceEvent<?>> eventConsumer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hibernate.Interceptor
afterTransactionCompletion, beforeTransactionCompletion, findDirty, findDirty, getEntity, getEntity, getEntityName, instantiate, instantiate, isTransient, onCollectionRecreate, onCollectionRecreate, onCollectionRemove, onCollectionRemove, onCollectionUpdate, onCollectionUpdate, onDelete, onFlushDirty, onLoad, onLoad, onSave, postFlush, preFlush
-
Field Details
-
eventConsumer
-
persistenceEvents
-
-
Constructor Details
-
PersistenceEventInterceptor
public PersistenceEventInterceptor()
-
-
Method Details
-
setEventConsumer
-
onSave
public boolean onSave(Object entity, Object id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) throws org.hibernate.CallbackException - Specified by:
onSave
in interfaceorg.hibernate.Interceptor
- Throws:
org.hibernate.CallbackException
-
onFlushDirty
public boolean onFlushDirty(Object entity, Object id, Object[] currentState, Object[] previousState, String[] propertyNames, org.hibernate.type.Type[] types) throws org.hibernate.CallbackException - Specified by:
onFlushDirty
in interfaceorg.hibernate.Interceptor
- Throws:
org.hibernate.CallbackException
-
onDelete
public void onDelete(Object entity, Object id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) - Specified by:
onDelete
in interfaceorg.hibernate.Interceptor
-
afterTransactionBegin
public void afterTransactionBegin(org.hibernate.Transaction tx) - Specified by:
afterTransactionBegin
in interfaceorg.hibernate.Interceptor
-