public void add( Class entity, ClassLoaderService classLoaderService, EntityBinding binding ) { addCallback( entity, preCreates, PrePersist.class, classLoaderService, binding ); addCallback( entity, postCreates, PostPersist.class, classLoaderService, binding ); addCallback( entity, preRemoves, PreRemove.class, classLoaderService, binding ); addCallback( entity, postRemoves, PostRemove.class, classLoaderService, binding ); addCallback( entity, preUpdates, PreUpdate.class, classLoaderService, binding ); addCallback( entity, postUpdates, PostUpdate.class, classLoaderService, binding ); addCallback( entity, postLoads, PostLoad.class, classLoaderService, binding ); }
private boolean callback(Callback[] callbacks, Object bean) { if ( callbacks != null && callbacks.length != 0 ) { for ( Callback callback : callbacks ) { callback.invoke( bean ); } return true; } else { return false; } }
@Override protected boolean invokeSaveLifecycle(Object entity, EntityPersister persister, EventSource source) { callbackHandler.preCreate( entity ); //always call the precreate event even if on safe vetoe it return super.invokeSaveLifecycle( entity, persister, source ); } }
public void onPostUpdate(PostUpdateEvent event) { Object entity = event.getEntity(); EntityEntry entry = (EntityEntry) event.getSession().getPersistenceContext().getEntityEntries().get( entity ); //mimic the preUpdate filter if ( Status.DELETED != entry.getStatus() ) { callbackHandler.postUpdate( entity ); } } }
@Override protected boolean invokeDeleteLifecycle(EventSource session, Object entity, EntityPersister persister) { callbackHandler.preRemove( entity ); return super.invokeDeleteLifecycle( session, entity, persister ); }
public void onPostInsert(PostInsertEvent event) { Object entity = event.getEntity(); callbackHandler.postCreate( entity ); } }
public void onPostUpdate(PostUpdateEvent event) { Object entity = event.getEntity(); EventSource eventSource = event.getSession(); handlePostUpdate(entity, eventSource); }
@Override protected Serializable saveWithRequestedId(Object entity, Serializable requestedId, String entityName, Object anything, EventSource source) { callbackHandler.preCreate( entity ); return super.saveWithRequestedId( entity, requestedId, entityName, anything, source ); }
public void add(XClass entity, ReflectionManager reflectionManager) { addCallback( entity, preCreates, PrePersist.class, reflectionManager ); addCallback( entity, postCreates, PostPersist.class, reflectionManager ); addCallback( entity, preRemoves, PreRemove.class, reflectionManager ); addCallback( entity, postRemoves, PostRemove.class, reflectionManager ); addCallback( entity, preUpdates, PreUpdate.class, reflectionManager ); addCallback( entity, postUpdates, PostUpdate.class, reflectionManager ); addCallback( entity, postLoads, PostLoad.class, reflectionManager ); }
private boolean callback(Callback[] callbacks, Object bean) { if ( callbacks != null && callbacks.length != 0 ) { for ( Callback callback : callbacks ) { callback.invoke( bean ); } return true; } else { return false; } }
public void onPostUpdate(PostUpdateEvent event) { Object entity = event.getEntity(); EventSource eventSource = event.getSession(); handlePostUpdate(entity, eventSource); }
@Override protected Serializable saveWithGeneratedId(Object entity, String entityName, Object anything, EventSource source, boolean requiresImmediateIdAccess) { callbackHandler.preCreate( entity ); return super.saveWithGeneratedId( entity, entityName, anything, source, requiresImmediateIdAccess ); }
public void add(XClass entity, ReflectionManager reflectionManager) { addCallback( entity, preCreates, PrePersist.class, reflectionManager ); addCallback( entity, postCreates, PostPersist.class, reflectionManager ); addCallback( entity, preRemoves, PreRemove.class, reflectionManager ); addCallback( entity, postRemoves, PostRemove.class, reflectionManager ); addCallback( entity, preUpdates, PreUpdate.class, reflectionManager ); addCallback( entity, postUpdates, PostUpdate.class, reflectionManager ); addCallback( entity, postLoads, PostLoad.class, reflectionManager ); }
private boolean callback(Callback[] callbacks, Object bean) { if ( callbacks != null && callbacks.length != 0 ) { for ( Callback callback : callbacks ) { callback.invoke( bean ); } return true; } else { return false; } }
@Override protected boolean invokeSaveLifecycle(Object entity, EntityPersister persister, EventSource source) { callbackHandler.preCreate( entity ); //always call the precreate event even if on safe vetoe it return super.invokeSaveLifecycle( entity, persister, source ); } }
public void add(XClass entity, ReflectionManager reflectionManager) { addCallback( entity, preCreates, PrePersist.class, reflectionManager ); addCallback( entity, postCreates, PostPersist.class, reflectionManager ); addCallback( entity, preRemoves, PreRemove.class, reflectionManager ); addCallback( entity, postRemoves, PostRemove.class, reflectionManager ); addCallback( entity, preUpdates, PreUpdate.class, reflectionManager ); addCallback( entity, postUpdates, PostUpdate.class, reflectionManager ); addCallback( entity, postLoads, PostLoad.class, reflectionManager ); }
@Override protected Serializable saveWithGeneratedId( Object entity, String entityName, Object anything, EventSource source, boolean requiresImmediateIdAccess) { callbackHandler.preCreate( entity ); return super.saveWithGeneratedId( entity, entityName, anything, source, requiresImmediateIdAccess ); } }
@Override protected Serializable saveWithGeneratedId(Object entity, String entityName, Object anything, EventSource source, boolean requiresImmediateIdAccess) { callbackHandler.preCreate( entity ); return super.saveWithGeneratedId( entity, entityName, anything, source, requiresImmediateIdAccess ); } }
@Override protected Serializable saveWithRequestedId( Object entity, Serializable requestedId, String entityName, Object anything, EventSource source) { callbackHandler.preCreate( entity ); return super.saveWithRequestedId( entity, requestedId, entityName, anything, source ); }
@Override protected Serializable saveWithGeneratedId( Object entity, String entityName, Object anything, EventSource source, boolean requiresImmediateIdAccess) { callbackHandler.preCreate( entity ); return super.saveWithGeneratedId( entity, entityName, anything, source, requiresImmediateIdAccess ); } }