hibernate与JPA的关系
来源:互联网 发布:java编程输出质数 编辑:程序博客网 时间:2024/06/05 07:21
hibernate与JPA的关系
(摘自hibernate官网)
http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html
1. Architecture
1.1. Overview
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. The Java application makes use of the Hibernate APIs to load, store, query, etc its domain data. Here we will introduce the essential Hibernate APIs. This will be a brief introduction; we will discuss these contracts in detail later.
As a JPA provider, Hibernate implements the Java Persistence API specifications and the association between JPA interfaces and Hibernate specific implementations can be visualized in the following diagram:
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.
Session (org.hibernate.Session)
A single-threaded, short-lived object conceptually modeling a “Unit of Work” PoEAA. In JPA nomenclature, the Session is represented by an EntityManager.
Behind the scenes, the Hibernate Session wraps a JDBC java.sql.Connection and acts as a factory for org.hibernate.Transaction instances. It maintains a generally “repeatable read” persistence context (first level cache) of the application domain model.
Transaction (org.hibernate.Transaction)
A single-threaded, short-lived object used by the application to demarcate individual physical transaction boundaries. EntityTransaction is the JPA equivalent and both act as an abstraction API to isolate the application from the underlying transaction system in use (JDBC or JTA).
- jpa与hibernate的关系
- JPA与Hibernate的关系
- JPA与Hibernate的关系
- Hibernate与Jpa的关系
- Hibernate与Jpa的关系
- Hibernate与Jpa的关系
- Hibernate与Jpa的关系
- JPA与Hibernate的关系
- Hibernate与Jpa的关系
- Hibernate与Jpa的关系
- JPA与Hibernate的关系
- Hibernate与Jpa的关系
- JPA与Hibernate的关系
- Hibernate与Jpa的关系
- hibernate与JPA的关系
- Hibernate与Jpa的关系
- Hibernate与Jpa的关系
- 什么是JPA及与Hibernate的关系
- Python + pyqt5 图片批量缩放工具
- Docker背后的内核知识——Namespace资源隔离
- 提升自我的好工具和网站汇总[目前我在用的]
- cpu显示详细信息
- Python的学习路线
- hibernate与JPA的关系
- STM32--GPIO
- 设计模式----简单工厂模式
- 数据类型
- 最小生成树---克鲁斯卡尔算法
- Nameko中文教程
- python os.path模块常用方法详解
- 常用SQL语句
- 函数