Polishing

This commit is contained in:
Juergen Hoeller
2014-08-11 15:45:54 +02:00
parent 1034b0dae2
commit e2d71a8ccd
7 changed files with 33 additions and 22 deletions

View File

@@ -91,6 +91,9 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
* support nested transactions! Hence, do not expect Hibernate access code to
* semantically participate in a nested transaction.</i>
*
* <p><b>NOTE: Hibernate 4.2+ is strongly recommended for efficient transaction
* management with Spring, in particular for transactional Spring JDBC access.</b>
*
* @author Juergen Hoeller
* @since 3.1
* @see #setSessionFactory
@@ -437,7 +440,7 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana
throw new InvalidIsolationLevelException(
"HibernateTransactionManager is not allowed to support custom isolation levels: " +
"make sure that its 'prepareConnection' flag is on (the default) and that the " +
"Hibernate connection release mode is set to 'on_close' (SpringTransactionFactory's default).");
"Hibernate connection release mode is set to 'on_close' (the default for JDBC).");
}
if (logger.isDebugEnabled()) {
logger.debug("Not preparing JDBC Connection of Hibernate Session [" + session + "]");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,8 +79,8 @@ public class SpringSessionContext implements CurrentSessionContext {
else if (value instanceof SessionHolder) {
SessionHolder sessionHolder = (SessionHolder) value;
Session session = sessionHolder.getSession();
if (TransactionSynchronizationManager.isSynchronizationActive() &&
!sessionHolder.isSynchronizedWithTransaction()) {
if (!sessionHolder.isSynchronizedWithTransaction() &&
TransactionSynchronizationManager.isSynchronizationActive()) {
TransactionSynchronizationManager.registerSynchronization(
new SpringSessionSynchronization(sessionHolder, this.sessionFactory));
sessionHolder.setSynchronizedWithTransaction(true);