Update of /cvsroot/springframework/spring/src/org/springframework/orm/hibernate3
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9263/src/org/springframework/orm/hibernate3
Modified Files:
HibernateTransactionManager.java
Log Message:
fixed HibernateTransactionManager's "earlyFlushBeforeCommit" feature to apply to the outermost transaction only
Index: HibernateTransactionManager.java
===================================================================
RCS file: /cvsroot/springframework/spring/src/org/springframework/orm/hibernate3/HibernateTransactionManager.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** HibernateTransactionManager.java 23 Oct 2008 09:25:39 -0000 1.42
--- HibernateTransactionManager.java 24 Oct 2008 22:38:06 -0000 1.43
***************
*** 299,312 ****
* Set whether to perform an early flush before proceeding with a commit.
* <p>Default is "false", performing an implicit flush as part of the actual
! * commit step. Switch this to "true" in order to enforce an explicit flush
! * at the end of each successfully passed transaction boundary.
! * <p>This can be used to automatically make Hibernate-driven database changes
! * visible at the end of inner transactions, e.g. in order to have JDBC access
! * code operating on the flushed data later on in the same transaction.
* <p>An early flush happens before the before-commit synchronization phase,
* making flushed state visible to <code>beforeCommit</code> callbacks of registered
* {@link org.springframework.transaction.support.TransactionSynchronization}
* objects. Such explicit flush behavior is consistent with Spring-driven
! * flushing in a JTA transaction environment, so may also be enforced for
* consistency with JTA transaction behavior.
* @see #prepareForCommit
--- 299,309 ----
* Set whether to perform an early flush before proceeding with a commit.
* <p>Default is "false", performing an implicit flush as part of the actual
! * commit step. Switch this to "true" in order to enforce an explicit early
! * flush right <i>before</i> the actual commit step.
* <p>An early flush happens before the before-commit synchronization phase,
* making flushed state visible to <code>beforeCommit</code> callbacks of registered
* {@link org.springframework.transaction.support.TransactionSynchronization}
* objects. Such explicit flush behavior is consistent with Spring-driven
! * flushing in a JTA transaction environment, so may also get enforced for
* consistency with JTA transaction behavior.
* @see #prepareForCommit
***************
*** 631,635 ****
protected void prepareForCommit(DefaultTransactionStatus status) {
! if (this.earlyFlushBeforeCommit) {
HibernateTransactionObject txObject = (HibernateTransactionObject) status.getTransaction();
Session session = txObject.getSessionHolder().getSession();
--- 628,632 ----
protected void prepareForCommit(DefaultTransactionStatus status) {
! if (this.earlyFlushBeforeCommit && status.isNewTransaction()) {
HibernateTransactionObject txObject = (HibernateTransactionObject) status.getTransaction();
Session session = txObject.getSessionHolder().getSession();
***************
*** 643,649 ****
}
finally {
! if (status.isNewTransaction()) {
! session.setFlushMode(FlushMode.NEVER);
! }
}
}
--- 640,644 ----
}
finally {
! session.setFlushMode(FlushMode.NEVER);
}
}
|