SessionFactory
SessionFactory is a Hibernate interface that creates Session instances for interacting with a database.
Test Driven: Practical TDD and Acceptance TDD for Java Developers
SessionFactory is a Hibernate interface that creates and provides database sessions.
- How it is used
- Provides Hibernate sessions to data-access objects for persistence and queries.
- How deep it goes
- Explains SessionFactory collaboration and configuration, then exercises session acquisition in unit and integration tests.
- Examples
- Uses a person DAO, a mocked last-name lookup, and an in-memory HSQLDB integration setup.
- What you can do after
- Applies SessionFactory through Hibernate to save and query objects and test DAO behavior.
Read how Test Driven: Practical TDD and Acceptance TDD for Java Developers explains SessionFactory →
Java Persistence with Spring Data and Hibernate epub
SessionFactory is Hibernate's thread-safe factory for creating Session instances and managing Hibernate persistence resources.
- How it is used
- Bootstraps native Hibernate and supplies sessions for persistence operations, especially when Hibernate-specific features are required.
- How deep it goes
- Explains configuration, construction, API switching, and session lifecycle, but defers most routine examples to JPA or Spring Data JPA.
- Examples
- Uses hibernate.cfg.xml, annotated Message and Item classes, Java bootstrap code, DAO access, and Spring’s LocalSessionFactoryBean.
- What you can do after
- Build it from scratch using native Hibernate configuration, or switch from JPA through EntityManagerFactory.unwrap(SessionFactory.class).
Read how Java Persistence with Spring Data and Hibernate epub explains SessionFactory →
Related concepts
- Hibernate sessionproduces · A Hibernate Session is an interface that manages persistent entity instances and database interactions within a persistence context and unit of work.
- Hibernateproduced by · Hibernate is a Java object-relational mapping and persistence framework that maps Java objects to relational database data and manages their persistence.
- Springconfigured by · Spring Framework is an open-source Java application framework that provides infrastructure and programming models for building applications.
Questions about SessionFactory
What is SessionFactory?
SessionFactory is a Hibernate interface that creates Session instances for interacting with a database.
Which Manning books explain SessionFactory?
Test Driven: Practical TDD and Acceptance TDD for Java Developers and Java Persistence with Spring Data and Hibernate epub.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

