Layered Architecture of Hibernate


Layered Architecture of Hibernate

Hibernate offers a layered architecture that allows users to work without knowing the underlying APIs. Many objects are included in the Hibernate architecture, including persistent objects, session factories, transaction factories, connection factories session, and transaction factories.

There are four layers to Hibernate's architecture.

  1. Application layer in Java
  2. Framework layer for Hibernate
  3. API layer for the backhand
  4. Layer of the database

Hibernate's high-level architecture, including the mapping and configuration files.

Hibernate's high-level architecture, including the mapping and configuration files. The Hibernate framework makes use of a variety of objects, including session factory, session, and transaction, as well as existing Java APIs like JDBC (Java Database Connectivity), JTA (Java Transaction API), and JNDI (Java Named Data Interface).

Hibernate Architecture Elements

We need to understand the basics of Hibernate architecture to create the first hibernate application. The following are the details:

  1. SessionFactory: The ConnectionProvider's SessionFactory is a session and client factory. It stores data in a second-level cache (optional).
  2. Session: The session object acts as a conduit between the application and the database data. It covers the JDBC connection and is a short-lived object. It is a Transaction, Query, and Criteria factory. It has a necessary first-level cache of data. Factory methods for Transaction, Query, and Criteria are also available.
  3. Transaction:The atomic unit of work is specified by the transaction object.
  4. ConnectionProvider: It's a JDBC connection factory. It hides the application's connection to the DriverManager or DataSource. It's a choice.
  5. TransactionFactory: It's a transaction factory. It's a choice.