Class PersistenceEventInterceptor

java.lang.Object
org.openremote.container.persistence.PersistenceEventInterceptor
All Implemented Interfaces:
org.hibernate.Interceptor

public class PersistenceEventInterceptor extends Object implements org.hibernate.Interceptor
Intercept Hibernate lifecycle events and publish a message.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Consumer<org.openremote.model.PersistenceEvent<?>>
     
    protected Set<org.openremote.model.PersistenceEvent<?>>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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

      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, Object id, Object[] state, String[] propertyNames, org.hibernate.type.Type[] types) throws org.hibernate.CallbackException
      Specified by:
      onSave in interface org.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 interface org.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 interface org.hibernate.Interceptor
    • afterTransactionBegin

      public void afterTransactionBegin(org.hibernate.Transaction tx)
      Specified by:
      afterTransactionBegin in interface org.hibernate.Interceptor