Hibernate Architecture (entry)

Hibernate the medium to operation by the database persistent objects (PO), the underlying database for the application is transparent.

Hibernate application released from the original JDBC access, the application does not care about JDBC operation, the underlying database connection, a database access implementation, transaction control, but in the object-oriented manner operating persistence layer directly.

Hibernate brief Architecture:

 

 

 

 

Which hibernate.properties and XML Mapping are configuration files, configuration object model (Persistent Objects) and the relational model (Database) mappings.

 

 

 

Hibernate Core API

Configuration class
configuration Hibernate, roots start Hibernate. Hibernate Application Configuration instance specified by the object - the position of a file or relational mapping Hibernate dynamic configuration attributes, and then create an instance of an object SesssionFaction.

Interface SessionFactory
initialization Hibernate, serving as a data storage source agent, created Session object, a data storage SessionFactory corresponding to a source (DB).

Session interface
is responsible for saving, update, delete, and query object is loaded, it is the most widely Hibernate applications using the interface, also known as the persistence manager.

Transaction Interface
Management, is Hibernate database transaction interfaces, it made the transaction interface to the underlying package, the underlying transaction interfaces include: API JDBC, JTA and CORBA transaction.

Query Interface and Cirteria

  • Perform database queries, these two interfaces is the Hibernate query interface for querying objects to a database, and control the execution of the query.
  • Query包装了一个HQL(Hibernate Query Language)查询语句,HQL查询语句和SQL语句是相似的,但是HQL查询语句是面向对象的,它引用类名及类的属性名,而不是表名及表的字段名。
  • Cirteria接口完全封装了基于字符串形式的查询语句,比Query接口更加面向对象,Cirteria更擅长于执行动态查询。

 

转载于:https://www.cnblogs.com/lucky1024/p/11024303.html

Guess you like

Origin blog.csdn.net/weixin_33754065/article/details/93249896