Class JpaEntityVersionListener
- java.lang.Object
-
- org.keycloak.models.map.storage.jpa.hibernate.listeners.JpaEntityVersionListener
-
- All Implemented Interfaces:
Serializable
,org.hibernate.event.spi.PreDeleteEventListener
,org.hibernate.event.spi.PreInsertEventListener
,org.hibernate.event.spi.PreUpdateEventListener
public class JpaEntityVersionListener extends Object implements org.hibernate.event.spi.PreInsertEventListener, org.hibernate.event.spi.PreDeleteEventListener, org.hibernate.event.spi.PreUpdateEventListener
Listen on changes on child- and root entities and updates the current entity version of the root. This support a multiple level parent-child relationship, where the upmost parent needs the entity version to be updated.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static JpaEntityVersionListener
INSTANCE
-
Constructor Summary
Constructors Constructor Description JpaEntityVersionListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
onPreDelete(org.hibernate.event.spi.PreDeleteEvent event)
boolean
onPreInsert(org.hibernate.event.spi.PreInsertEvent event)
boolean
onPreUpdate(org.hibernate.event.spi.PreUpdateEvent event)
void
updateEntityVersion(Object entity)
Traverse from current entity up to the upmost parent, then update the entity version if it is a root entity.
-
-
-
Field Detail
-
INSTANCE
public static final JpaEntityVersionListener INSTANCE
-
-
Method Detail
-
updateEntityVersion
public void updateEntityVersion(Object entity) throws org.hibernate.HibernateException
Traverse from current entity up to the upmost parent, then update the entity version if it is a root entity.- Throws:
org.hibernate.HibernateException
-
onPreInsert
public boolean onPreInsert(org.hibernate.event.spi.PreInsertEvent event)
- Specified by:
onPreInsert
in interfaceorg.hibernate.event.spi.PreInsertEventListener
-
onPreDelete
public boolean onPreDelete(org.hibernate.event.spi.PreDeleteEvent event)
- Specified by:
onPreDelete
in interfaceorg.hibernate.event.spi.PreDeleteEventListener
-
onPreUpdate
public boolean onPreUpdate(org.hibernate.event.spi.PreUpdateEvent event)
- Specified by:
onPreUpdate
in interfaceorg.hibernate.event.spi.PreUpdateEventListener
-
-