Spring/Spring Data JPA
Hibernate docs - 1. 아키텍처
wampy
2022. 11. 24. 12:13
1. 아키텍처
1. 개요
- Hibernate, as an ORM solution, effectively "sits between" the Java application data access layer and the Relational Database, as can be seen in the diagram above
- ORM 솔루션인 하이버네이트는 자바 어플리케이션 데이터 액세스 계층과 관계형 데이터베이스 사이에 효과적으로 위치한다.
- The Java application makes use of the Hibernate APIs to load, store, query, etc. its domain data.
- 자바 어플리케이션은 Hibernate API를 사용하여 도메인 데이터를 로드, 저장, 쿼리 등을 수행한다.
- As a Jakarta Persistence provider, Hibernate implements the Java Persistence API specifications and the association between Jakarta Persistence interfaces and Hibernate specific implementations can be visualized in the following diagram
- Jakarta Persistence 공급자로서 하이버네이트는 Java Persistence API 사양을 구현하고 Jakarta Persistence 인터페이스와 Hibernate 특정 구현 사이의 연결은 다음 다이어그램에서 시각화한다.
- specification 사양
- association 연결
- visualized 시각화하다
- Jakarta Persistence 공급자로서 하이버네이트는 Java Persistence API 사양을 구현하고 Jakarta Persistence 인터페이스와 Hibernate 특정 구현 사이의 연결은 다음 다이어그램에서 시각화한다.
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.org.hibernate.Session
인스턴스의 팩토리 역할을 한다.
- The
EntityManagerFactory
is the Jakarta Persistence equivalent of aSessionFactory
and basically, those two converge into the sameSessionFactory
implementation.EntityManagerFactory
는SessionFactory
와 동등한 Jakarta Persistence 이며, 기본적으로 이 둘은 동일한SessionFactory
구현체로 수렴된다.- equivalent 동등한,
- converge 모여들다, 집중하다, 수렴하다
- A
SessionFactory
is very expensive to create, so, for any given database, the application should have only one associatedSessionFactory.
SessionFactory
는 만드는 데 비용이 많이 들기 때문에, 주어진 데이터베이스에 대해 애플리케이션은 오직SessionFactory
하나만 연결되어있어야 한다.
- The
SessionFactory
maintains services that Hibernate uses across allSession(s)
such as second level caches, connection pools, transaction system integrations, etc.SessionFactory
는 2차 캐시, 커넥션풀, 트랜잭션 시스템 통합 등과 같은 모든Session
을 거쳐 Hiberante가 사용하는 서비스를 유지한다
- A thread-safe (and immutable) representation of the mapping of the application domain model to a database.
Session
(org.hibernate.Session
)- A single-threaded, short-lived object conceptually modeling a "Unit of Work" (PoEAA). In Jakarta Persistence nomenclature, the
Session
is represented by anEntityManager
.- 개념적으로 '작업 단위'(PoEAA)를 모델링하는 싱글 스레드, 단기 객체이다. Jakarta Persistence 명명법에서,
Session
은EntityManager
로 표시된다.- nomenclature : 명명법
- 개념적으로 '작업 단위'(PoEAA)를 모델링하는 싱글 스레드, 단기 객체이다. Jakarta Persistence 명명법에서,
- Behind the scenes, the Hibernate
Session
wraps a JDBCjava.sql.Connection
and acts as a factory fororg.hibernate.Transaction
instances.- 막후에서, Hibernate
Session
은 JDBCjava.sql.Connection
을 감싼고org.hibernate.Transaction
인스턴스의 팩토리 역할을한다.
- 막후에서, Hibernate
- It maintains a generally "repeatable read" persistence context (first level cache) of the application domain model.
- 이것은 일반적으로 애플리케이션 도메일 모델의 '반복 가능한' 영속성 컨텍스트 (1차 캐시)를 유지한다.
- A single-threaded, short-lived object conceptually modeling a "Unit of Work" (PoEAA). In Jakarta Persistence nomenclature, the
Transaction
(org.hibernate.Transaction
)- A single-threaded, short-lived object used by the application to demarcate individual physical transaction boundaries.
- 애플리케이션에서 개별 물리적 트렌잭션 경계를 구분하는 데 사용하는 싱글 스레드의 짧은 수명 객체이다.
- demarcate 경계를 구분하다
- 애플리케이션에서 개별 물리적 트렌잭션 경계를 구분하는 데 사용하는 싱글 스레드의 짧은 수명 객체이다.
EntityTransaction
is the Jakarta Persistence equivalent and both act as an abstraction API to isolate the application from the underlying transaction system in use (JDBC or JTA).EntityTransaction
은 Jakarta Persistence 와 동일하며 두가지 모두 사용중인 (JDBC 혹은 JTA) 기본 트랜잭션 시스템으로부터 어플리케이션을 격리하는 추상화 API 역할을 한다.
- A single-threaded, short-lived object used by the application to demarcate individual physical transaction boundaries.