level architecture of Hibernate can be
described as shown in following illustration.
makes use of persistent objects commonly
called as POJO (POJO = "Plain Old
Java Object".) along with XML mapping
documents for persisting objects to the
database layer. The term POJO refers to
a normal Java objects that does not serve
any other special role or implement any
special interfaces of any of the Java
frameworks (EJB, JDBC, DAO, JDO, etc...).
than utilize byte code processing or code
generation, Hibernate uses runtime reflection
to determine the persistent properties
of a class. The objects to be persisted
are defined in a mapping document, which
serves to describe the persistent fields
and associations, as well as any subclasses
or proxies of the persistent object. The
mapping documents are compiled at application
startup time and provide the framework
with necessary information for a class.
Additionally, they are used in support
operations, such as generating the database
schema or creating stub Java source files.
= new Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
Customer newCustomer = new Customer();
of New Customer");
step is hibernate application is to retrieve
Hibernate Session; Hibernate Session is
the main runtime interface between a Java
application and Hibernate. SessionFactory
allows applications to create hibernate
session by reading hibernate configurations
After specifying transaction boundaries,
application can make use of persistent
java objects and use session for persisting
to the databases.