diff --git a/framework-docs/modules/ROOT/pages/data-access/orm/hibernate.adoc b/framework-docs/modules/ROOT/pages/data-access/orm/hibernate.adoc index 149841aeb3..f83b433f28 100644 --- a/framework-docs/modules/ROOT/pages/data-access/orm/hibernate.adoc +++ b/framework-docs/modules/ROOT/pages/data-access/orm/hibernate.adoc @@ -14,9 +14,9 @@ As of Spring Framework 6.0, Spring requires Hibernate ORM 5.5+ for Spring's `HibernateJpaVendorAdapter` as well as for a native Hibernate `SessionFactory` setup. We recommend Hibernate ORM 5.6 as the last feature branch in that Hibernate generation. -Hibernate ORM 6.x is only supported as a JPA provider (`HibernateJpaVendorAdapter`). -Plain `SessionFactory` setup with the `orm.hibernate5` package is not supported anymore. -We recommend Hibernate ORM 6.1/6.2 with JPA-style setup for new development projects. +Hibernate ORM 6.x is primarily supported as a JPA provider (`HibernateJpaVendorAdapter`). +Plain `SessionFactory` setup with the `orm.hibernate5` package is tolerated for migration +purposes. We recommend Hibernate ORM 6.x with JPA-style setup for new development projects. ==== diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTransactionManager.java b/spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTransactionManager.java index d2c62ae669..f44a5c249c 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTransactionManager.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate5/HibernateTransactionManager.java @@ -97,10 +97,6 @@ import org.springframework.util.Assert; * support nested transactions! Hence, do not expect Hibernate access code to * semantically participate in a nested transaction. * - *
NOTE: Hibernate ORM 6.x is officially only supported as a JPA provider. - * Please use {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean} - * with {@link org.springframework.orm.jpa.JpaTransactionManager} there instead. - * * @author Juergen Hoeller * @since 4.2 * @see #setSessionFactory @@ -285,10 +281,9 @@ public class HibernateTransactionManager extends AbstractPlatformTransactionMana /** * Set whether to operate on a Hibernate-managed Session instead of a * Spring-managed Session, that is, whether to obtain the Session through - * Hibernate's {@link SessionFactory#getCurrentSession()} - * instead of {@link SessionFactory#openSession()} (with a Spring - * {@link TransactionSynchronizationManager} - * check preceding it). + * Hibernate's {@link SessionFactory#getCurrentSession()} instead of + * {@link SessionFactory#openSession()} (with a Spring + * {@link TransactionSynchronizationManager} check preceding it). *
Default is "false", i.e. using a Spring-managed Session: taking the current * thread-bound Session if available (for example, in an Open-Session-in-View scenario), * creating a new Session for the current transaction otherwise. diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBean.java b/spring-orm/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBean.java index 5aff74181a..37ede5b9b4 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBean.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate5/LocalSessionFactoryBean.java @@ -68,10 +68,6 @@ import org.springframework.lang.Nullable; * {@link HibernateTransactionManager}, this naturally allows for mixing JPA access code * with native Hibernate access code within the same transaction. * - *
NOTE: Hibernate ORM 6.x is officially only supported as a JPA provider. - * Please use {@link org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean} - * with {@link org.springframework.orm.jpa.JpaTransactionManager} there instead. - * * @author Juergen Hoeller * @since 4.2 * @see #setDataSource diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate5/package-info.java b/spring-orm/src/main/java/org/springframework/orm/hibernate5/package-info.java index 0ee67d0774..247d1474b7 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate5/package-info.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate5/package-info.java @@ -1,14 +1,11 @@ /** * Package providing integration of - * Hibernate 5.x + * Hibernate ORM 5.x * with Spring concepts. * - *
Contains an implementation of Spring's transaction SPI for local Hibernate transactions.
- * This package is intentionally rather minimal, with no template classes or the like,
- * in order to follow Hibernate recommendations as closely as possible. We recommend
- * using Hibernate's native sessionFactory.getCurrentSession()
style.
- *
- *
This package supports Hibernate 5.x only. + *
This package supports Hibernate 5.x while also tolerating use against
+ * Hibernate ORM 6.x for migration purposes. Note that we strongly recommend
+ * Hibernate's native sessionFactory.getCurrentSession()
style.
*/
@NonNullApi
@NonNullFields
diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java
index a1784a73ab..20fe3ace4b 100644
--- a/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java
+++ b/spring-orm/src/main/java/org/springframework/orm/jpa/vendor/HibernateJpaDialect.java
@@ -75,7 +75,7 @@ import org.springframework.util.ReflectionUtils;
/**
* {@link org.springframework.orm.jpa.JpaDialect} implementation for Hibernate.
- * Compatible with Hibernate ORM 5.5/5.6 as well as 6.0/6.1/6.2/6.3.
+ * Compatible with Hibernate ORM 5.5/5.6 as well as 6.x.
*
* @author Juergen Hoeller
* @author Costin Leau
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 0a15fb226a..842d6dcc34 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
@@ -47,7 +47,7 @@ import org.springframework.util.ClassUtils;
/**
* {@link org.springframework.orm.jpa.JpaVendorAdapter} implementation for Hibernate.
- * Compatible with Hibernate ORM 5.5/5.6 as well as 6.0/6.1/6.2/6.3.
+ * Compatible with Hibernate ORM 5.5/5.6 as well as 6.x.
*
*
Exposes Hibernate's persistence provider and Hibernate's Session as extended * EntityManager interface, and adapts {@link AbstractJpaVendorAdapter}'s common