1. 程式人生 > >Hibernate ORM 5.1 User Guide

Hibernate ORM 5.1 User Guide

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. The EntityManagerFactory is the JPA equivalent of a SessionFactory

and basically those two converge into the same SessionFactory implementation.

A SessionFactory is very expensive to create, so, for any given database, the application should have only one associated SessionFactory. The SessionFactory maintains services that Hibernate uses across all Session(s) such as second level caches, connection pools, transaction system integrations, etc.

線程安全

Hibernate ORM 5.1 User Guide