Search in sources :

Example 1 with PreDeleteEvent

use of org.hibernate.event.spi.PreDeleteEvent in project gorm-hibernate5 by grails.

the class ClosureEventTriggeringInterceptor method onPreDelete.

public boolean onPreDelete(PreDeleteEvent hibernateEvent) {
    AbstractPersistenceEvent event = new org.grails.datastore.mapping.engine.event.PreDeleteEvent(this.datastore, hibernateEvent.getEntity());
    publishEvent(hibernateEvent, event);
    return event.isCancelled();
}
Also used : PreDeleteEvent(org.hibernate.event.spi.PreDeleteEvent) AbstractPersistenceEvent(org.grails.datastore.mapping.engine.event.AbstractPersistenceEvent)

Example 2 with PreDeleteEvent

use of org.hibernate.event.spi.PreDeleteEvent in project hibernate-orm by hibernate.

the class EntityDeleteAction method preDelete.

protected boolean preDelete() {
    boolean veto = false;
    final EventListenerGroup<PreDeleteEventListener> listenerGroup = getFastSessionServices().eventListenerGroup_PRE_DELETE;
    if (listenerGroup.isEmpty()) {
        return veto;
    }
    final PreDeleteEvent event = new PreDeleteEvent(getInstance(), getId(), state, getPersister(), eventSource());
    for (PreDeleteEventListener listener : listenerGroup.listeners()) {
        veto |= listener.onPreDelete(event);
    }
    return veto;
}
Also used : PreDeleteEvent(org.hibernate.event.spi.PreDeleteEvent) PreDeleteEventListener(org.hibernate.event.spi.PreDeleteEventListener)

Aggregations

PreDeleteEvent (org.hibernate.event.spi.PreDeleteEvent)2 AbstractPersistenceEvent (org.grails.datastore.mapping.engine.event.AbstractPersistenceEvent)1 PreDeleteEventListener (org.hibernate.event.spi.PreDeleteEventListener)1