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.
- Application layer in Java
- Framework layer for Hibernate
- API layer for the backhand
- 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:
- SessionFactory: The ConnectionProvider's SessionFactory is a session and client factory. It stores data in a second-level cache (optional).
- 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.
- Transaction:The atomic unit of work is specified by the transaction object.
- ConnectionProvider: It's a JDBC connection factory. It hides the application's connection to the DriverManager or DataSource. It's a choice.
- TransactionFactory: It's a transaction factory. It's a choice.