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 Details

    • eventConsumer

      protected Consumer<org.openremote.model.PersistenceEvent<?>> eventConsumer
    • persistenceEvents

      protected Set<org.openremote.model.PersistenceEvent<?>> persistenceEvents
  • Constructor Details

    • PersistenceEventInterceptor

      public PersistenceEventInterceptor()
  • Method Details

    • setEventConsumer

      public void setEventConsumer(Consumer<org.openremote.model.PersistenceEvent<?>> eventConsumer)
    • onSave

      public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) throws org.hibernate.CallbackException
      Specified by:
      onSave in interface org.hibernate.Interceptor
      Overrides:
      onSave in class org.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:
      onFlushDirty in interface org.hibernate.Interceptor
      Overrides:
      onFlushDirty in class org.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:
      onDelete in interface org.hibernate.Interceptor
      Overrides:
      onDelete in class org.hibernate.EmptyInterceptor
    • afterTransactionBegin

      public void afterTransactionBegin(org.hibernate.Transaction tx)
      Specified by:
      afterTransactionBegin in interface org.hibernate.Interceptor
      Overrides:
      afterTransactionBegin in class org.hibernate.EmptyInterceptor
    • afterTransactionCompletion

      public void afterTransactionCompletion(org.hibernate.Transaction tx)
      Specified by:
      afterTransactionCompletion in interface org.hibernate.Interceptor
      Overrides:
      afterTransactionCompletion in class org.hibernate.EmptyInterceptor