1 package org.hibernate.event.def; 3 4 import org.hibernate.HibernateException; 5 import org.hibernate.event.DirtyCheckEvent; 6 import org.hibernate.event.DirtyCheckEventListener; 7 import org.apache.commons.logging.Log; 8 import org.apache.commons.logging.LogFactory; 9 10 17 public class DefaultDirtyCheckEventListener extends AbstractFlushingEventListener implements DirtyCheckEventListener { 18 19 private static final Log log = LogFactory.getLog(DefaultDirtyCheckEventListener.class); 20 21 26 public boolean onDirtyCheck(DirtyCheckEvent event) throws HibernateException { 27 28 boolean wasNeeded = false; 29 int oldSize = event.getSession().getActionQueue().numberOfCollectionRemovals(); 30 31 try { 32 flushEverythingToExecutions(event); 33 wasNeeded = event.getSession().getActionQueue().hasAnyQueuedActions(); 34 log.debug( wasNeeded ? "session dirty" : "session not dirty" ); 35 return wasNeeded; 36 } 37 finally { 38 event.getSession().getActionQueue().clearFromFlushNeededCheck( oldSize ); 39 } 40 } 41 } 42 | Popular Tags |