• October 14, 2014
  • Hibernate
  • Comments Off on Hibernate architecture

Hibernate architecture

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.


hibernate 3

Core Components of Hibernate architecture:

hibernate 4

Configuration object:

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.

SessionFactory object:

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.

Session object:

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.

Transaction object:

The Transaction object is created from Session object. A transaction object represents an atomic unit of work.

Query object:

The Query object is created from Session object. It uses SQL and HQL to perform database operations.

Criteria object:

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.

Related Topics:

How to build java project using ant in eclipse?
JAXB marshalling – convert java object to xml example.
How to create pdf file in java using iText jar?
Generics class example.
OGNL in struts 2.
Hibernate One-to-One Mapping using xml.
Send inline image in email using JavaMail API.
Quartz 2 JobListener example.


Comments are closed.