SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
Introduction to Hibernate Framework
www.collaborationtech.co.in
Bengaluru INDIA
Presentation By
Ramananda M.S Rao
Content
Content
Introduction
Object Persistence
Hibernate Configuration
Persistent Classes
Annotations
Persistence Life Cycle
Components and Model
Mapping and Association
Entity Inheritance with Hibernate
Intermediate Concepts
Hibernate Query and Criteria
Fetching Strategies
Hibernate objects
Listeners
Project
About Us
www.collaborationtech.co.in
Introduction
 Hibernate framework simplifies the development of java application to interact
with the database. Hibernate is an open source, lightweight, ORM (Object
Relational Mapping) tool.
 An ORM tool simplifies the data creation, data manipulation and data access. It
is a programming technique that maps the object to the data stored in the
database.
Advantages of Hibernate Framework
 Open source and Lightweight
 Fast performance
 Database Independent query: HQL (Hibernate Query Language) is the object-
oriented version of SQL.
 Automatic table creation: Hibernate framework provides the facility to create
the tables of the database automatically. So there is no need to create tables in
the database manually.
 Simplifies complex join: To fetch data form multiple tables is easy in hibernate
framework.
 Hibernate supports Query cache and provide statistics about query and database
status.
www.collaborationtech.co.in
Hibernate Framework Architecture
www.collaborationtech.co.in
Example
StudentEntity.java
package entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "student")
public class StudentEntity {
@Id
@Column(name = "ID")
private int id;
@Column(name = "NAME")
private String name;
@Column(name = "DEPARTMENT")
private String department;
@Column(name = "COLLEGE")
private String college;
public int getId() {
return id;}
www.collaborationtech.co.in
Example
public void setId(int id) {this.id = id;}
public String getName() {return name;}
public void setName(String name) {this.name = name;}
public String getDepartment() {return department;}
public void setDepartment(String department) {this.department =
department;}
public String getCollege() {return college;}
public void setCollege(String college) {this.college = college;
}}
www.collaborationtech.co.in
Example
package util;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import entity.StudentEntity;
public class HibernateUtil {
public static void main(String[] args) {
Configuration cf = new Configuration().configure("hibernate.cfg.xml");
StandardServiceRegistryBuilder srb = new StandardServiceRegistryBuilder();
srb.applySettings(cf.getProperties());
ServiceRegistry sr = srb.build();
SessionFactory sf = cf.buildSessionFactory(sr);
Session session = sf.openSession();
www.collaborationtech.co.in
Example
StudentEntity std = new StudentEntity();
std.setId(100); // Primary Key
std.setName("Ravindra");
std.setDepartment("ECE");
std.setCollege("RNS Bangalore");
Transaction tx = session.beginTransaction();
session.save(std);
tx.commit();
System.out.println("Object saved successfully.....!!");
session.close();
sf.close();
}
}
www.collaborationtech.co.in
Example
hibernate.cfg
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver
</property>
<!-- Assume students is the database name -->
<property name="hibernate.connection.url">
jdbc:mysql://localhost/testdb
</property>
<property name="hibernate.connection.username">
testdb
</property>
<property name="hibernate.connection.password">
root
</property>
<mapping class="entity.StudentEntity"/>
</session-factory>
</hibernate-configuration>
www.collaborationtech.co.in
Follow us on Social
Facebook: https://www.facebook.com/collaborationtechnologies/
Twitter : https://twitter.com/collaboration09
Google Plus : https://plus.google.com/100704494006819853579
LinkedIn : https://www.linkedin.com/in/ramananda-rao-a2012545
Instagram : https://instagram.com/collaborationtechnologies
YouTube :
https://www.youtube.com/channel/UCm9nK56LRbWSqcYWbzs8CUg
Skype : facebook:ramananda.rao.7
WhatsApp : +91 9886272445
www.collaborationtech.co.in
THANK YOU
About Us

More Related Content

What's hot (20)

PPT
Hibernate Tutorial
Ram132
 
DOC
Hibernate tutorial for beginners
Rahul Jain
 
PPTX
Spring (1)
Aneega
 
PPT
jpa-hibernate-presentation
John Slick
 
PPTX
Hibernate in Nutshell
Onkar Deshpande
 
PPT
Java Persistence API (JPA) Step By Step
Guo Albert
 
PPT
Introduction to hibernate
hr1383
 
PPT
Intro To Hibernate
Amit Himani
 
PDF
Introduction to JPA and Hibernate including examples
ecosio GmbH
 
PDF
Hibernate Presentation
guest11106b
 
PPTX
Introduction to JPA Framework
Collaboration Technologies
 
PDF
Hibernate 3
Rajiv Gupta
 
PDF
JPA and Hibernate
elliando dias
 
PPT
Hibernate architecture
Anurag
 
ODP
Hibernate Developer Reference
Muthuselvam RS
 
PPTX
JPA For Beginner's
NarayanaMurthy Ganashree
 
PPTX
Introduction to JPA (JPA version 2.0)
ejlp12
 
PPTX
Hibernate inheritance and relational mappings with examples
Er. Gaurav Kumar
 
PDF
Data access
Joshua Yoon
 
Hibernate Tutorial
Ram132
 
Hibernate tutorial for beginners
Rahul Jain
 
Spring (1)
Aneega
 
jpa-hibernate-presentation
John Slick
 
Hibernate in Nutshell
Onkar Deshpande
 
Java Persistence API (JPA) Step By Step
Guo Albert
 
Introduction to hibernate
hr1383
 
Intro To Hibernate
Amit Himani
 
Introduction to JPA and Hibernate including examples
ecosio GmbH
 
Hibernate Presentation
guest11106b
 
Introduction to JPA Framework
Collaboration Technologies
 
Hibernate 3
Rajiv Gupta
 
JPA and Hibernate
elliando dias
 
Hibernate architecture
Anurag
 
Hibernate Developer Reference
Muthuselvam RS
 
JPA For Beginner's
NarayanaMurthy Ganashree
 
Introduction to JPA (JPA version 2.0)
ejlp12
 
Hibernate inheritance and relational mappings with examples
Er. Gaurav Kumar
 
Data access
Joshua Yoon
 

Viewers also liked (19)

PDF
Introduction To Hibernate
ashishkulkarni
 
PPTX
Initial short film ideas
Filipstojcic
 
PPTX
A PRESENTATION ON STRUTS & HIBERNATE
Tushar Choudhary
 
PPSX
An isas presentation on .net framework 2.0 by vikash chandra das
Vikash Chandra Das
 
PPT
Perl tutorial
Manav Prasad
 
PPTX
Struts & hibernate ppt
Pankaj Patel
 
PPTX
Introduction to Hibernate Framework
Collaboration Technologies
 
PPTX
Introduction to Spring Framework
Raveendra R
 
PDF
Hibernate an introduction
joseluismms
 
PPT
Hibernate
reddivarihareesh
 
PPT
02 Hibernate Introduction
Ranjan Kumar
 
RTF
THE WORLDS NO.1 BLACK MAGIC EXPERT WITH POWERFUL LOVE SPELLS +27631229624
mamaalphah alpha
 
DOCX
Short Film Script
khalfyard
 
PPT
Introduction to hibernate
Muhammad Zeeshan
 
PDF
Hibernate ORM: Tips, Tricks, and Performance Techniques
Brett Meyer
 
PPS
Java Hibernate Programming with Architecture Diagram and Example
kamal kotecha
 
PDF
Short film script PDF
Brandon_Wood
 
DOCX
Script - Role Play.
renee
 
PPTX
Slideshare ppt
Mandy Suzanne
 
Introduction To Hibernate
ashishkulkarni
 
Initial short film ideas
Filipstojcic
 
A PRESENTATION ON STRUTS & HIBERNATE
Tushar Choudhary
 
An isas presentation on .net framework 2.0 by vikash chandra das
Vikash Chandra Das
 
Perl tutorial
Manav Prasad
 
Struts & hibernate ppt
Pankaj Patel
 
Introduction to Hibernate Framework
Collaboration Technologies
 
Introduction to Spring Framework
Raveendra R
 
Hibernate an introduction
joseluismms
 
Hibernate
reddivarihareesh
 
02 Hibernate Introduction
Ranjan Kumar
 
THE WORLDS NO.1 BLACK MAGIC EXPERT WITH POWERFUL LOVE SPELLS +27631229624
mamaalphah alpha
 
Short Film Script
khalfyard
 
Introduction to hibernate
Muhammad Zeeshan
 
Hibernate ORM: Tips, Tricks, and Performance Techniques
Brett Meyer
 
Java Hibernate Programming with Architecture Diagram and Example
kamal kotecha
 
Short film script PDF
Brandon_Wood
 
Script - Role Play.
renee
 
Slideshare ppt
Mandy Suzanne
 
Ad

Similar to Introduction to Hibernate Framework (20)

PPTX
Hibernate example1
myrajendra
 
PPTX
Hibernate Training Session1
Asad Khan
 
PDF
Hibernate using jpa
Mohammad Faizan
 
PPTX
New-Hibernate-introduction cloud cc.pptx
bgvthm
 
PPT
Hibernate Tutorial for beginners
rajkamal560066
 
PPT
Hibernate for Beginners
Ramesh Kumar
 
PDF
Hibernate Tutorial
Syed Shahul
 
PPTX
Hibernate
Mallikarjuna G D
 
PPT
Basic Hibernate Final
Rafael Coutinho
 
PPT
hibernate with JPA
Mohammad Faizan
 
PPTX
Module-3 for career and JFSD ppt for study.pptx
ViratKohli78
 
PPTX
Session 40 - Hibernate - Part 2
PawanMM
 
PPT
5-Hibernate.ppt
ShivaPriya60
 
PPTX
Session 3 - hibernate - Configuration with Annotations.pptx
ASRPANDEY
 
PPTX
Hibernate online training
QUONTRASOLUTIONS
 
PDF
inf5750---lecture-2.-c---hibernate-intro.pdf
bhqckkgwglxjcuctdf
 
PPT
Hibernate
Shaharyar khan
 
PPTX
Session 39 - Hibernate - Part 1
PawanMM
 
PPT
Patni Hibernate
patinijava
 
PPTX
Hibernet-and-struts-spring-classess-in-mumbai
Vibrant Technologies & Computers
 
Hibernate example1
myrajendra
 
Hibernate Training Session1
Asad Khan
 
Hibernate using jpa
Mohammad Faizan
 
New-Hibernate-introduction cloud cc.pptx
bgvthm
 
Hibernate Tutorial for beginners
rajkamal560066
 
Hibernate for Beginners
Ramesh Kumar
 
Hibernate Tutorial
Syed Shahul
 
Hibernate
Mallikarjuna G D
 
Basic Hibernate Final
Rafael Coutinho
 
hibernate with JPA
Mohammad Faizan
 
Module-3 for career and JFSD ppt for study.pptx
ViratKohli78
 
Session 40 - Hibernate - Part 2
PawanMM
 
5-Hibernate.ppt
ShivaPriya60
 
Session 3 - hibernate - Configuration with Annotations.pptx
ASRPANDEY
 
Hibernate online training
QUONTRASOLUTIONS
 
inf5750---lecture-2.-c---hibernate-intro.pdf
bhqckkgwglxjcuctdf
 
Hibernate
Shaharyar khan
 
Session 39 - Hibernate - Part 1
PawanMM
 
Patni Hibernate
patinijava
 
Hibernet-and-struts-spring-classess-in-mumbai
Vibrant Technologies & Computers
 
Ad

More from Raveendra R (6)

PPTX
Introduction to AngularJS Framework
Raveendra R
 
PPTX
Introduction to Android Programming
Raveendra R
 
PPTX
Introduction to JSON & AJAX
Raveendra R
 
PPTX
Introduction to JavaScript Programming
Raveendra R
 
PPTX
Introduction to Core Java Programming
Raveendra R
 
PPTX
Introduction to Python Basics Programming
Raveendra R
 
Introduction to AngularJS Framework
Raveendra R
 
Introduction to Android Programming
Raveendra R
 
Introduction to JSON & AJAX
Raveendra R
 
Introduction to JavaScript Programming
Raveendra R
 
Introduction to Core Java Programming
Raveendra R
 
Introduction to Python Basics Programming
Raveendra R
 

Recently uploaded (20)

PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Biography of Daniel Podor.pdf
Daniel Podor
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 

Introduction to Hibernate Framework

  • 1. Introduction to Hibernate Framework www.collaborationtech.co.in Bengaluru INDIA Presentation By Ramananda M.S Rao
  • 2. Content Content Introduction Object Persistence Hibernate Configuration Persistent Classes Annotations Persistence Life Cycle Components and Model Mapping and Association Entity Inheritance with Hibernate Intermediate Concepts Hibernate Query and Criteria Fetching Strategies Hibernate objects Listeners Project About Us www.collaborationtech.co.in
  • 3. Introduction  Hibernate framework simplifies the development of java application to interact with the database. Hibernate is an open source, lightweight, ORM (Object Relational Mapping) tool.  An ORM tool simplifies the data creation, data manipulation and data access. It is a programming technique that maps the object to the data stored in the database. Advantages of Hibernate Framework  Open source and Lightweight  Fast performance  Database Independent query: HQL (Hibernate Query Language) is the object- oriented version of SQL.  Automatic table creation: Hibernate framework provides the facility to create the tables of the database automatically. So there is no need to create tables in the database manually.  Simplifies complex join: To fetch data form multiple tables is easy in hibernate framework.  Hibernate supports Query cache and provide statistics about query and database status. www.collaborationtech.co.in
  • 5. Example StudentEntity.java package entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "student") public class StudentEntity { @Id @Column(name = "ID") private int id; @Column(name = "NAME") private String name; @Column(name = "DEPARTMENT") private String department; @Column(name = "COLLEGE") private String college; public int getId() { return id;} www.collaborationtech.co.in
  • 6. Example public void setId(int id) {this.id = id;} public String getName() {return name;} public void setName(String name) {this.name = name;} public String getDepartment() {return department;} public void setDepartment(String department) {this.department = department;} public String getCollege() {return college;} public void setCollege(String college) {this.college = college; }} www.collaborationtech.co.in
  • 7. Example package util; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; import entity.StudentEntity; public class HibernateUtil { public static void main(String[] args) { Configuration cf = new Configuration().configure("hibernate.cfg.xml"); StandardServiceRegistryBuilder srb = new StandardServiceRegistryBuilder(); srb.applySettings(cf.getProperties()); ServiceRegistry sr = srb.build(); SessionFactory sf = cf.buildSessionFactory(sr); Session session = sf.openSession(); www.collaborationtech.co.in
  • 8. Example StudentEntity std = new StudentEntity(); std.setId(100); // Primary Key std.setName("Ravindra"); std.setDepartment("ECE"); std.setCollege("RNS Bangalore"); Transaction tx = session.beginTransaction(); session.save(std); tx.commit(); System.out.println("Object saved successfully.....!!"); session.close(); sf.close(); } } www.collaborationtech.co.in
  • 9. Example hibernate.cfg <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.dialect"> org.hibernate.dialect.MySQLDialect </property> <property name="hibernate.connection.driver_class"> com.mysql.jdbc.Driver </property> <!-- Assume students is the database name --> <property name="hibernate.connection.url"> jdbc:mysql://localhost/testdb </property> <property name="hibernate.connection.username"> testdb </property> <property name="hibernate.connection.password"> root </property> <mapping class="entity.StudentEntity"/> </session-factory> </hibernate-configuration> www.collaborationtech.co.in
  • 10. Follow us on Social Facebook: https://www.facebook.com/collaborationtechnologies/ Twitter : https://twitter.com/collaboration09 Google Plus : https://plus.google.com/100704494006819853579 LinkedIn : https://www.linkedin.com/in/ramananda-rao-a2012545 Instagram : https://instagram.com/collaborationtechnologies YouTube : https://www.youtube.com/channel/UCm9nK56LRbWSqcYWbzs8CUg Skype : facebook:ramananda.rao.7 WhatsApp : +91 9886272445 www.collaborationtech.co.in THANK YOU