Interface BeanPersistListener

  • All Known Implementing Classes:
    AbstractBeanPersistListener

    public interface BeanPersistListener
    Listens for committed bean events.

    These listen events occur after a successful commit. They also occur in a background thread rather than the thread used to perform the actual insert update or delete. In this way there is a delay between the commit and when the listener is notified of the event.

    It is worth noting that BeanPersistListener is different in two main ways from BeanPersistController postXXX methods.

    • BeanPersistListener only sees successfully committed events. BeanPersistController pre and post methods occur before the commit or a rollback and will see events that are later rolled back
    • BeanPersistListener runs in a background thread and will not effect the response time of the actual persist where as BeanPersistController code will

    A BeanPersistListener is either found automatically via class path search or can be added programmatically via DatabaseConfig.add(BeanPersistListener)}.

    See Also:
    DatabaseConfig.add(BeanPersistListener)
    • Method Detail

      • isRegisterFor

        boolean isRegisterFor​(Class<?> cls)
        Return true if this BeanPersistListener should be registered for events on this entity type.
      • inserted

        void inserted​(Object bean)
        Notified that a bean has been inserted.
        Parameters:
        bean - The bean that was inserted.
      • updated

        void updated​(Object bean,
                     Set<String> updatedProperties)
        Notified that a bean has been updated.
        Parameters:
        bean - The bean that was updated.
        updatedProperties - The properties that were modified by this update.
      • deleted

        void deleted​(Object bean)
        Notified that a bean has been deleted.
        Parameters:
        bean - The bean that was deleted.
      • softDeleted

        void softDeleted​(Object bean)
        Notified that a bean has been soft deleted.
        Parameters:
        bean - The bean that was soft deleted.