Hibernate architecture consist of hibernate core components and use existing Java APIs. It uses JDBC API for common functionality to communicate with relational database and JNDI and JTA to integrate hibernate to the java application servers.
Core Components of Hibernate architecture:
The configuration object consist the configuration file used by the hibernate. It mainly consist the information about database connection (hibernate.cfg.xml) and class mapping (.hbm.xml). Configuration object is used to create the object of SessionFactory.
The SessionFactory object is created from the Configuration object. It is thread-safe object and used by all threads of the application. It is act as a factory for session objects and client for ConnectionProvider. It maintains the second level cache of the data.
The session object is created from the SessionFactory object. It is act as a factory for Transaction, Query and Criteria. Session objects are not thread-safe. It maintains the first level cache.
The Transaction object is created from Session object. A transaction object represents an atomic unit of work.
The Query object is created from Session object. It uses SQL and HQL to perform database operations.
The Criteria object is created from the Session object. It is used to define and execute the object oriented criteria queries.
Next Topic: Hibernate configuration file with example.
Previous Topic: Hibernate framework.