Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Hibernate Framework
1.
2. Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
4. INTRODUCTION
• Hibernate is an Object-relational mapping
(ORM) tool.
• ORM is a programming method for mapping
the objects to the relational model where
entities/classes are mapped to tables,
instances are mapped to rows and attributes
of instances are mapped to columns of table.
5. What does Hibernate do??
• Hibernate provides a solution to map database
tables to a class.
• It copies one row of the database data to a
class.
• In the other direction it supports to save
objects to the database.
• Saving data to a storage is called persistence.
And the copying of tables to objects and vice
versa is called object relational mapping.
7. PERSISTENT CLASS
• Java classes whose objects or instances will be
stored in database tables are called persistent
classes in Hibernate.
8. Example of Persisting an Object
// get a Hibernate SessionFactory for Session management
sessionFactory = new Configuration()
.configure().buildSessionFactory();
// an Event object that we want to save
Location ku = new Location( "Kasetsart University" );
ku.setAddress( "90 Pahonyotin Road; Bangkok" );
Event event = new Event("Java Days");
event.setLocation( ku );
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
session.save( event );
tx.commit();
session.close();
9. CREATING A JAVA PROJECT USING
HIBERNATE
• STEPS
1. Create a Java Project
2. Add jar Files for Hibernate
3. Create the persistent class
4. Create Mapping File for Persistence Class
5. Create the configuration file
6. Create the class that retrieves or stores the
persistent object
7. Run the application
11. DOWNLOAD JAR FILES
• we can download jars related to hibernate at
• http://sourceforge.net/projects/hibernate/files/
hibernate3
• From the above URL choose hibernate 3.2.2-
ga.zip, as we are in initial stage this version will be
better.
• Unzip it, and now you can find some jar files in
the lib folder right..?, actually we doesn’t require
all the jar files, out of them just select the
following jar files..
18. ADVANTAGES OF HIBERNATE
• Opensource and lightweight
• Database independent querying
• Automatic table creation
19.
20. If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
21. Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com