Tuesday 15 May 2012

Introduction to Hibernate

What is Configuration?
ØThe Configuration class is available in org.hibernate.cfg package
ØThis Class loads hibernate configuration file
ØHibernate Configuration file contains hibernate properties such as

Database Connection properties
Connection pool properties
Print all generated SQL Statements to console properties
Transaction properties
Disable or enable auto commit mode
Enabling or disabling Second level caching properties
Database Schema auto generation properties

What is SessionFactory?
ØIt the class of that implemented org.hibernate.SessionFactory interface
ØThis class instance is produced by buildSessionFactory() method
ØThis class creates pool of connections
ØThis class produces Session instance

What is Session?
ØThis class that implemented org.hibernate.Session interface.
ØThis class instance is produced by SessionFactory class openSession() method
ØThis class holds connection object and performs save(),saveOrUpdate(), update(), load(),get(),delete() method
ØDetermines optimistic way to do DB operations such as by determining statement/ Prepared Statement Object is better to improve the performance of DB interactions

What is Transaction class
This is class of that implemented org.hibernate.Transaction
This class instance is created when beginTransaction() method is called on SessionObject
The Transaction is completed by calling commit() or rollback() method

No comments:

Post a Comment