Our orm.hibernate5
package is outdated and in unclear state: It used to work with Hibernate ORM 5.x only but in Spring Framework 6.x we also tolerated its use against Hibernate ORM 6.x (with a few tweaks).
As of Spring Framework 7.0 and Hibernate ORM 7.0, we cannot support our outdated HibernateTemplate
at all anymore (due to the underlying query facility having been removed in Hibernate itself). At the same time, there is still a need for some native Hibernate support classes but ideally tightly integrated with JPA and HibernateJpaVendorAdapter
. In order to share some delegates with HibernateJpaVendorAdapter
(without circular package dependencies), those classes should live under orm.jpa.hibernate
instead which also removes the misleading version number from the package name.
Specifically, the following classes will be provided in org.springframework.orm.jpa.hibernate
for use with Hibernate ORM 7.0:
- LocalSessionFactoryBuilder
- LocalSessionFactoryBean
- HibernateTransactionManager
- HibernateExceptionTranslator
- SpringBeanContainer
- SpringSessionContext
Those classes are useful for use with JPA-based repositories as well as Hibernate-native repositories based on SessionFactory.getCurrentSession()
, and not least of it all for a mix of both. An existing orm.hibernate5
based setup can easily be migrated to use the orm.jpa.hibernate
setup classes while the repositories would keep using SessionFactory.getCurrentSession()
from an injected SessionFactory
instance, without any changes necessary for the repository implementations themselves. For any remaining HibernateTemplate
-based repositories, the recommendation is to migrate to SessionFactory.getCurrentSession()
.