Class EntityCallbacksListener

  • public class EntityCallbacksListener
    extends java.lang.Object
    A listener class to invoke entity callbacks in cases where Hibernate doesn't invoke the callback as expected.

    JPA defines a few annotations, e.g. PostLoad, that we can use for the application to react to certain events that occur inside the persistence mechanism. However, Hibernate only supports a few basic use cases, e.g. defining a PostLoad method directly in an Entity class or in an Embeddable class. If the annotated method is defined in an Embeddable class that is a property of another Embeddable class, or it is defined in a parent class of the Embeddable class, Hibernate doesn't invoke it.

    This listener is added in core/src/main/resources/META-INF/orm.xml as a default entity listener whose annotated methods will be invoked by Hibernate when corresponding events happen. For example, prePersist(java.lang.Object) will be invoked before the entity is persisted to the database, then it will recursively invoke any other PrePersist method that should be invoked but not handled by Hibernate due to the bug.

    See Also:
    JPA Callbacks, HHH-13316
    • Method Summary

      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EntityCallbacksListener

        public EntityCallbacksListener()