Hibernate ORM 5.1 User Guide
阿新 • • 發佈:2017-10-18
base 線程 線程安全 org ext safe ger system ide
1. Architecture
1.1. Overview
SessionFactory (org.hibernate.SessionFactory
)
-
A thread-safe (and immutable) representation of the mapping of the application domain model to a database. Acts as a factory for
org.hibernate.Session
instances. TheEntityManagerFactory
is the JPA equivalent of aSessionFactory
SessionFactory
implementation.A
SessionFactory
is very expensive to create, so, for any given database, the application should have only one associatedSessionFactory
. TheSessionFactory
maintains services that Hibernate uses across allSession(s)
such as second level caches, connection pools, transaction system integrations, etc.線程安全
Hibernate ORM 5.1 User Guide