Hibernate Architecture contains many objects like persistent object, session factory, transaction factory, session, transaction etc.
There are four layer architecture categorized in hibernate.
- Java application Layer.
- Hibernate Framework Layer.
- Backhand Api Layer.
- Database Layer.
Elements of Hibernate Architecture:
We must know these elements of Hibernate Architecture.
Session Factory : The session factory is a factory of session and client of Connection provider. It holds the second level of cache to hold data which is optional.
Session :The session object provides the interface between the application and data stored in database. It holds the first level cache (mandatory) of data. The org.hibernate. Session interface provides methods to insert, update and delete the object. It also provides factory methods for Transaction, Query and Criteria.
Transaction : The transaction object specifies the atomic unit of work. It is optional. The org.hibernate.Transaction interface provides methods for transaction management.
Connection Provider: It is a factory of JDBC connections. It abstracts the application from DriverManager or DataSource. It is optional.