Search in sources :

Example 1 with AutoFlushEventListener

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

the class SessionImpl method autoFlushIfRequired.

/**
 * detect in-memory changes, determine if the changes are to tables
 * named in the query and, if so, complete execution the flush
 */
protected boolean autoFlushIfRequired(Set querySpaces) throws HibernateException {
    checkOpen();
    if (!isTransactionInProgress()) {
        // do not auto-flush while outside a transaction
        return false;
    }
    AutoFlushEvent event = new AutoFlushEvent(querySpaces, this);
    for (AutoFlushEventListener listener : listeners(EventType.AUTO_FLUSH)) {
        listener.onAutoFlush(event);
    }
    return event.isFlushRequired();
}
Also used : AutoFlushEventListener(org.hibernate.event.spi.AutoFlushEventListener) AutoFlushEvent(org.hibernate.event.spi.AutoFlushEvent)

Aggregations

AutoFlushEvent (org.hibernate.event.spi.AutoFlushEvent)1 AutoFlushEventListener (org.hibernate.event.spi.AutoFlushEventListener)1