Search in sources :

Example 1 with FlushEventListener

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

the class SessionImpl method doFlush.

private void doFlush() {
    checkTransactionNeeded();
    checkTransactionSynchStatus();
    try {
        if (persistenceContext.getCascadeLevel() > 0) {
            throw new HibernateException("Flush during cascade is dangerous");
        }
        FlushEvent flushEvent = new FlushEvent(this);
        for (FlushEventListener listener : listeners(EventType.FLUSH)) {
            listener.onFlush(flushEvent);
        }
        delayedAfterCompletion();
    } catch (RuntimeException e) {
        throw exceptionConverter.convert(e);
    }
}
Also used : AutoFlushEventListener(org.hibernate.event.spi.AutoFlushEventListener) FlushEventListener(org.hibernate.event.spi.FlushEventListener) FlushEvent(org.hibernate.event.spi.FlushEvent) AutoFlushEvent(org.hibernate.event.spi.AutoFlushEvent) HibernateException(org.hibernate.HibernateException)

Aggregations

HibernateException (org.hibernate.HibernateException)1 AutoFlushEvent (org.hibernate.event.spi.AutoFlushEvent)1 AutoFlushEventListener (org.hibernate.event.spi.AutoFlushEventListener)1 FlushEvent (org.hibernate.event.spi.FlushEvent)1 FlushEventListener (org.hibernate.event.spi.FlushEventListener)1