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

會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
Krashi Coaching
 

Último (20)

Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading RoomImplanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
Implanted Devices - VP Shunts: EMGuidewire's Radiology Reading Room
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
Benefits and Challenges of OER by Shweta Babel.pptx
Benefits and Challenges of OER by Shweta Babel.pptxBenefits and Challenges of OER by Shweta Babel.pptx
Benefits and Challenges of OER by Shweta Babel.pptx
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
The Ball Poem- John Berryman_20240518_001617_0000.pptx
The Ball Poem- John Berryman_20240518_001617_0000.pptxThe Ball Poem- John Berryman_20240518_001617_0000.pptx
The Ball Poem- John Berryman_20240518_001617_0000.pptx
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 

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