01: //$Id: DefaultFlushEventListener.java 6929 2005-05-27 03:54:08Z oneovthafew $
02: package org.hibernate.event.def;
03:
04: import org.hibernate.HibernateException;
05: import org.hibernate.event.EventSource;
06: import org.hibernate.event.FlushEvent;
07: import org.hibernate.event.FlushEventListener;
08:
09: /**
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
16: AbstractFlushingEventListener implements FlushEventListener {
17:
18: /** Handle the given flush event.
19: *
20: * @param event The flush event to be handled.
21: * @throws HibernateException
22: */
23: public void onFlush(FlushEvent event) throws HibernateException {
24: final EventSource source = event.getSession();
25: if (source.getPersistenceContext().hasNonReadOnlyEntities()) {
26:
27: flushEverythingToExecutions(event);
28: performExecutions(source);
29: postFlush(source);
30:
31: if (source.getFactory().getStatistics()
32: .isStatisticsEnabled()) {
33: source.getFactory().getStatisticsImplementor().flush();
34: }
35:
36: }
37: }
38: }
|