小白自學hibernate5.0文檔第一季之架構篇

來源:互聯網
上載者:User

標籤:eve   細節   解決   png   discus   factor   first   org   方案   

  果然,hibernate的底層是由JDBC實現的。      --Java Data Base Connectivity,Java資料庫連接

                                                                  

  --翻譯得不到位,敬請批評

  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.

  Hibernate作為一個對象關係映射解決方案,能夠在java應用程式資料訪問層和關聯式資料庫“中間”起作用,如在中可以看出,Java應用程式利用Hibernate API去載入、儲存、查詢等其它域資料(不懂什麼叫域資料),這裡我們將介紹基本的Hibernate API。這將是一個簡單的介紹;稍後我們將會討論規約的細節。    

 

  

  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:

  作為JPA(Java Persistence API JAVA持久化API,小白理解其實就是@Entity,@Id,@Column等等之類的規範。)提供者,Hibernate實現Java Persistence API規範和JAP介面與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. 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.

 

  一個安全執行緒(並且不可變)領域模型到資料庫應用程式的映射代表,實際上它是作為一個工廠的org.hibernate.Session執行個體。這個EntityManagerFactory 是一個JPA Sessionfactory的等價物,主要地它們兩個收斂到相同的SessionFactory實現。

  去建立一個SessionFactory是非常昂貴的,所以,對於任何給定的資料庫,這個應用程式應該只有一個唯一的關聯--SessionFactory。SessionFactory維持Hibernate 使用所有的會話作為二級緩衝的服務,串連池,事務系統整合等等。

  

  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.

  一個單例線程,短暫的對象概念建模PoEAA“工作單元”(不愧是Hibernate,費解。。)在JAP術語裡,Session是一個EntityManager的代表。在幕後,Hibernate Session封裝了一個JDBC java.sql.Connection和實際作為一個工廠用於org.hibernate.Transaction執行個體它維持一個通常的“可複讀”應用領域模型的持久化上下文(一級緩衝)。

  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).

  一個單例線程,短生命對象通過應用程式去劃分個人的的物理事務邊界使用。EntityTransaction是一個JPA等價物和充當一個抽象API去使應用程式從底層事務系統中使用(JDBC或者JTA)隔離

 

小白自學hibernate5.0文檔第一季之架構篇

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.