SlideShare una empresa de Scribd logo
1 de 21
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
HIBERNATE FRAMEWORK
Subhin P.V
111subru@gmail.com
www.facebook.com/subhinv
elayudhan
twitter.com/111subru
in.linkedin.com/in/SubhinPv
8129076039
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.
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.
DIAGRAM
Presentation
layer
Logical layer
Database
PERSISTENT CLASS
• Java classes whose objects or instances will be
stored in database tables are called persistent
classes in Hibernate.
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();
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
CREATE JAVA PROJECT
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..
DOWNLOAD JAR FILES
• Anttr-2.7.6.jar
asm.jar
asm-attrs.jar
cglib-2.1.3.jar
commons-collections-2.1.1.jar
commons-logging-1.0.4.jar
ehcash.jar
dom4j-1.6.1.jar
hibernate3.jar
jta.jar
log4j-1.2.3.jar
CREATE PERSISTENT CLASS
CREATE A MAPPING FILE FOR THE
PERSISTANT CLASS
CREATE A CONFIGURATION FILE
CREATE THE CLASS THAT RETRIVES
OR STORES THE PERSISTANT CLASS
RUN THE APPLICATION
ADVANTAGES OF HIBERNATE
• Opensource and lightweight
• Database independent querying
• Automatic table creation
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
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

Más contenido relacionado

Similar a Hibernate Framework

Hibernate Tutorial
Hibernate TutorialHibernate Tutorial
Hibernate Tutorial
Syed Shahul
 
307d791b 3343-2e10-f78a-e1d50c7cf89a
307d791b 3343-2e10-f78a-e1d50c7cf89a307d791b 3343-2e10-f78a-e1d50c7cf89a
307d791b 3343-2e10-f78a-e1d50c7cf89a
vijaysrirams
 

Similar a Hibernate Framework (20)

Hibernate - Part 2
Hibernate - Part 2 Hibernate - Part 2
Hibernate - Part 2
 
Hibernate Tutorial
Hibernate TutorialHibernate Tutorial
Hibernate Tutorial
 
Owner - Java properties reinvented.
Owner - Java properties reinvented.Owner - Java properties reinvented.
Owner - Java properties reinvented.
 
Hibernate tutorial for beginners
Hibernate tutorial for beginnersHibernate tutorial for beginners
Hibernate tutorial for beginners
 
Session 40 - Hibernate - Part 2
Session 40 - Hibernate - Part 2Session 40 - Hibernate - Part 2
Session 40 - Hibernate - Part 2
 
Session 39 - Hibernate - Part 1
Session 39 - Hibernate - Part 1Session 39 - Hibernate - Part 1
Session 39 - Hibernate - Part 1
 
Hibernate Interview Questions and Answers
Hibernate Interview Questions and AnswersHibernate Interview Questions and Answers
Hibernate Interview Questions and Answers
 
Hibernate 3
Hibernate 3Hibernate 3
Hibernate 3
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Example
 
Spring MVC framework
Spring MVC frameworkSpring MVC framework
Spring MVC framework
 
React Native Firebase
React Native FirebaseReact Native Firebase
React Native Firebase
 
java framwork for HIBERNATE FRAMEWORK.pptx
java framwork for HIBERNATE FRAMEWORK.pptxjava framwork for HIBERNATE FRAMEWORK.pptx
java framwork for HIBERNATE FRAMEWORK.pptx
 
307d791b 3343-2e10-f78a-e1d50c7cf89a
307d791b 3343-2e10-f78a-e1d50c7cf89a307d791b 3343-2e10-f78a-e1d50c7cf89a
307d791b 3343-2e10-f78a-e1d50c7cf89a
 
How to train the jdt dragon
How to train the jdt dragonHow to train the jdt dragon
How to train the jdt dragon
 
Lesson 8 - Move Approved Elements To Insite Asset Library
Lesson 8 - Move Approved Elements To Insite Asset LibraryLesson 8 - Move Approved Elements To Insite Asset Library
Lesson 8 - Move Approved Elements To Insite Asset Library
 
Oop ppt
Oop pptOop ppt
Oop ppt
 
SAP data archiving
SAP data archivingSAP data archiving
SAP data archiving
 
Hibernate Interview Questions | Edureka
Hibernate Interview Questions | EdurekaHibernate Interview Questions | Edureka
Hibernate Interview Questions | Edureka
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
 
Codename BEAN.pptx
Codename BEAN.pptxCodename BEAN.pptx
Codename BEAN.pptx
 

Más de baabtra.com - No. 1 supplier of quality freshers

Más de baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Último

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Último (20)

Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 

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..
  • 12. DOWNLOAD JAR FILES • Anttr-2.7.6.jar asm.jar asm-attrs.jar cglib-2.1.3.jar commons-collections-2.1.1.jar commons-logging-1.0.4.jar ehcash.jar dom4j-1.6.1.jar hibernate3.jar jta.jar log4j-1.2.3.jar
  • 14. CREATE A MAPPING FILE FOR THE PERSISTANT CLASS
  • 16. CREATE THE CLASS THAT RETRIVES OR STORES THE PERSISTANT CLASS
  • 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