Source code: org/hibernate/event/def/DefaultFlushEventListener.java
1 //$Id: DefaultFlushEventListener.java,v 1.3 2005/02/22 03:09:34 oneovthafew Exp $
2 package org.hibernate.event.def;
3
4 import org.hibernate.HibernateException;
5 import org.hibernate.event.FlushEvent;
6 import org.hibernate.event.FlushEventListener;
7 import org.hibernate.engine.SessionImplementor;
8
9 /**
10 * Defines the default flush event listeners used by hibernate for
11 * flushing session state in response to generated flush events.
12 *
13 * @author Steve Ebersole
14 */
15 public class DefaultFlushEventListener extends AbstractFlushingEventListener implements FlushEventListener {
16
17 /** Handle the given flush event.
18 *
19 * @param event The flush event to be handled.
20 * @throws HibernateException
21 */
22 public void onFlush(FlushEvent event) throws HibernateException {
23 final SessionImplementor source = event.getSession();
24 if ( source.getPersistenceContext().hasNonReadOnlyEntities() ) {
25
26 flushEverythingToExecutions(event);
27 performExecutions(source);
28 postFlush(source);
29
30 if ( source.getFactory().getStatistics().isStatisticsEnabled() ) {
31 source.getFactory().getStatisticsImplementor().flush();
32 }
33
34 }
35 }
36 }