The Architecture of Hibernate Includes many Mappings Files and Configuration Files to run for it and Different types of object that we use for fetching data and also having interfaces and Classes for generating Sessions to work within Application. Similarly we are having Configuration, Session factory, Session, Transaction Object, Connection Provider, Query Object Etc.
The Basic Meaning of Configuration is like Mechanism that allows us, how to design and fulfill the inner Details of the objects during application Initialization. Configuration files allows us to read object which is later used to connect to a database .A Configuration file is used to create the object of Session Factory.
Session Factory :
According to the configuration file it provides us Session factory object. Session factory object is created only once during application Initialization and it stores second level cache of data and globally available for all application and also enable by default, org.hibernate.Sessionfactory interface provides us factory method to get the object of Session.This Session Factory methods is used by all threads.
Session object provides the interface to work b/w our java Application and Database., it is short time object and covered by JDBC Connection. It is factory of Transaction, Query and Criteria and stores Ist level cache by default. The org.hibernate.Session interface provides us to perform Basic CRUD (Create, Read, Update and Delete) Operations for the object and also maintain a cache for a single application. The Main thing is these Session objects are not thread safe due to this we can’t run these for long time.
Transaction Object :
These are optional and org.hibernate.Transaction interface provides us to method for transaction maintenance. A Transaction represents a unit of work with the Database.
Connection Provider :
It abstracts the area of JDBC Connections and implemented by the Coder/ Developer from Data source or Driver Manager.
Query Object :
Query objects use SQL or Hibernate Query Language (HQL) string to receive data from the database.