Class EntityCallbacksListener
- java.lang.Object
-
- google.registry.persistence.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 aPostLoad
method directly in anEntity
class or in anEmbeddable
class. If the annotated method is defined in anEmbeddable
class that is a property of anotherEmbeddable
class, or it is defined in a parent class of theEmbeddable
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 otherPrePersist
method that should be invoked but not handled by Hibernate due to the bug.- See Also:
- JPA Callbacks, HHH-13316
-
-
Constructor Summary
Constructors Constructor Description EntityCallbacksListener()
-