Class LocalSessionFactoryBuilder

java.lang.Object
org.hibernate.cfg.Configuration
org.springframework.orm.hibernate5.LocalSessionFactoryBuilder

public class LocalSessionFactoryBuilder extends Configuration
A Spring-provided extension of the standard Hibernate Configuration class, adding SpringSessionContext as a default and providing convenient ways to specify a JDBC DataSource and an application class loader.

This is designed for programmatic use, e.g. in @Bean factory methods; consider using LocalSessionFactoryBean for XML bean definition files. Typically combined with HibernateTransactionManager for declarative transactions against the SessionFactory and its JDBC DataSource.

Compatible with Hibernate ORM 5.5/5.6, as of Spring Framework 6.0. This Hibernate-specific factory builder can also be a convenient way to set up a JPA EntityManagerFactory since the Hibernate SessionFactory natively exposes the JPA EntityManagerFactory interface as well now.

This builder supports Hibernate BeanContainer integration, MetadataSources from custom BootstrapServiceRegistryBuilder setup, as well as other advanced Hibernate configuration options beyond the standard JPA bootstrap contract.

Since:
4.2
Author:
Juergen Hoeller
See Also: