diff --git a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/HibernateTransactionManager.java b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/HibernateTransactionManager.java index 9462ae5685..b74bc8c33d 100644 --- a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/HibernateTransactionManager.java +++ b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/HibernateTransactionManager.java @@ -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. * + *
NOTE: Hibernate 4.2+ is strongly recommended for efficient transaction + * management with Spring, in particular for transactional Spring JDBC access. + * * @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 + "]"); diff --git a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/SpringSessionContext.java b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/SpringSessionContext.java index 35180d2e3c..32e2f449f8 100644 --- a/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/SpringSessionContext.java +++ b/spring-orm-hibernate4/src/main/java/org/springframework/orm/hibernate4/SpringSessionContext.java @@ -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); diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/EclipseLinkJpaVendorAdapter.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/EclipseLinkJpaVendorAdapter.java index 907e9dbbe1..00fc01863e 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/EclipseLinkJpaVendorAdapter.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/EclipseLinkJpaVendorAdapter.java @@ -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. @@ -30,7 +30,8 @@ import org.springframework.orm.jpa.JpaDialect; /** * {@link org.springframework.orm.jpa.JpaVendorAdapter} implementation for Eclipse - * Persistence Services (EclipseLink). Developed and tested against EclipseLink 2.4. + * Persistence Services (EclipseLink). Developed and tested against EclipseLink 2.4; + * compatible with EclipseLink 2.5 as well. * *
Exposes EclipseLink's persistence provider and EntityManager extension interface, * and supports {@link AbstractJpaVendorAdapter}'s common configuration settings. @@ -43,10 +44,10 @@ import org.springframework.orm.jpa.JpaDialect; */ public class EclipseLinkJpaVendorAdapter extends AbstractJpaVendorAdapter { - private final PersistenceProvider persistenceProvider = new org.eclipse.persistence.jpa.PersistenceProvider(); - private final JpaDialect jpaDialect = new EclipseLinkJpaDialect(); + private final PersistenceProvider persistenceProvider = new org.eclipse.persistence.jpa.PersistenceProvider(); + @Override public PersistenceProvider getPersistenceProvider() { diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java index f26e54569b..eb4afff596 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaVendorAdapter.java @@ -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. @@ -45,11 +45,11 @@ import org.springframework.orm.jpa.JpaDialect; *
Exposes Hibernate's persistence provider and EntityManager extension interface, * and supports {@link AbstractJpaVendorAdapter}'s common configuration settings. * - *
Note that the package location of Hibernate's JPA support changed from 4.2 to 4.3: - * from {@code org.hibernate.ejb.HibernateEntityManager(Factory)} to - * {@code org.hibernate.jpa.HibernateEntityManager(Factory)}. As of Spring 4.0, - * we're exposing the correct, non-deprecated variant depending on the Hibernate - * version encountered at runtime, in order to avoid deprecation log entries. + *
Note that the Java package location of Hibernate's JPA support changed from + * 4.2 to 4.3: from {@code org.hibernate.ejb.HibernateEntityManager(Factory)} to + * {@code org.hibernate.jpa.HibernateEntityManager(Factory)}. + * As of Spring 4.0, we are exposing the appropriate, non-deprecated variant - + * depending on the specific Hibernate version encountered at runtime. * * @author Juergen Hoeller * @author Rod Johnson diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaVendorAdapter.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaVendorAdapter.java index 39592480f5..bcaedb4341 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaVendorAdapter.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/OpenJpaVendorAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 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. @@ -30,7 +30,7 @@ import org.springframework.orm.jpa.JpaDialect; /** * {@link org.springframework.orm.jpa.JpaVendorAdapter} implementation for Apache OpenJPA. - * Developed and tested against OpenJPA 2.2. + * Developed and tested against OpenJPA 2.2; compatible with OpenJPA 2.3 as well. * *
Exposes OpenJPA's persistence provider and EntityManager extension interface,
* and supports {@link AbstractJpaVendorAdapter}'s common configuration settings.
@@ -43,9 +43,9 @@ import org.springframework.orm.jpa.JpaDialect;
*/
public class OpenJpaVendorAdapter extends AbstractJpaVendorAdapter {
- private final PersistenceProvider persistenceProvider = new PersistenceProviderImpl();
+ private final JpaDialect jpaDialect = new OpenJpaDialect();
- private final OpenJpaDialect jpaDialect = new OpenJpaDialect();
+ private final PersistenceProvider persistenceProvider = new PersistenceProviderImpl();
@Override
diff --git a/spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java b/spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java
index ad6fe26042..693c43e093 100644
--- a/spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java
+++ b/spring-tx/src/main/java/org/springframework/transaction/support/AbstractPlatformTransactionManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 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.
@@ -1272,6 +1272,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
this.logger = LogFactory.getLog(getClass());
}
+
/**
* Holder for suspended resources.
* Used internally by {@code suspend} and {@code resume}.
@@ -1279,10 +1280,15 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
protected static class SuspendedResourcesHolder {
private final Object suspendedResources;
+
private List