SlideShare a Scribd company logo
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

PDF
Hibernate An Introduction
Nguyen Cao
 
PPTX
Introduction to Hibernate Framework
Raveendra R
 
PPT
Introduction to Hibernate
Krishnakanth Goud
 
PPTX
Introduction to JPA Framework
Collaboration Technologies
 
PPTX
Introduction to jQuery
Collaboration Technologies
 
PPTX
Hibernate Basic Concepts - Presentation
Khoa Nguyen
 
PPTX
java drag and drop and data transfer
Ankit Desai
 
Hibernate An Introduction
Nguyen Cao
 
Introduction to Hibernate Framework
Raveendra R
 
Introduction to Hibernate
Krishnakanth Goud
 
Introduction to JPA Framework
Collaboration Technologies
 
Introduction to jQuery
Collaboration Technologies
 
Hibernate Basic Concepts - Presentation
Khoa Nguyen
 
java drag and drop and data transfer
Ankit Desai
 

What's hot (20)

PPTX
Hibernate
Prashant Kalkar
 
PPTX
JPA For Beginner's
NarayanaMurthy Ganashree
 
PPTX
Hibernate Training Session1
Asad Khan
 
PPTX
java code and document security
Ankit Desai
 
PPT
Hibernate Tutorial
Ram132
 
PPTX
Hibernate ppt
Aneega
 
PPT
Introduction to hibernate
hr1383
 
PPT
Intro To Hibernate
Amit Himani
 
PPTX
Spring (1)
Aneega
 
PDF
Hibernate Presentation
guest11106b
 
PPT
jpa-hibernate-presentation
John Slick
 
PPTX
Hibernate in Nutshell
Onkar Deshpande
 
PPTX
Hibernate in Action
Akshay Ballarpure
 
PPTX
Hibernate inheritance and relational mappings with examples
Er. Gaurav Kumar
 
PPTX
Entity Framework: Nakov @ BFU Hackhaton 2015
Svetlin Nakov
 
PPT
Jpa
Manav Prasad
 
PPT
Java persistence api
Luis Goldster
 
PPTX
Ef code first
ZealousysDev
 
PPTX
Entity framework code first
Confiz
 
Hibernate
Prashant Kalkar
 
JPA For Beginner's
NarayanaMurthy Ganashree
 
Hibernate Training Session1
Asad Khan
 
java code and document security
Ankit Desai
 
Hibernate Tutorial
Ram132
 
Hibernate ppt
Aneega
 
Introduction to hibernate
hr1383
 
Intro To Hibernate
Amit Himani
 
Spring (1)
Aneega
 
Hibernate Presentation
guest11106b
 
jpa-hibernate-presentation
John Slick
 
Hibernate in Nutshell
Onkar Deshpande
 
Hibernate in Action
Akshay Ballarpure
 
Hibernate inheritance and relational mappings with examples
Er. Gaurav Kumar
 
Entity Framework: Nakov @ BFU Hackhaton 2015
Svetlin Nakov
 
Java persistence api
Luis Goldster
 
Ef code first
ZealousysDev
 
Entity framework code first
Confiz
 
Ad

Viewers also liked (12)

PPT
02 Hibernate Introduction
Ranjan Kumar
 
PPTX
Introduction to Spring Framework
Raveendra R
 
PPT
Hibernate
reddivarihareesh
 
RTF
THE WORLDS NO.1 BLACK MAGIC EXPERT WITH POWERFUL LOVE SPELLS +27631229624
mamaalphah alpha
 
PDF
Hibernate an introduction
joseluismms
 
PDF
Introduction To Hibernate
ashishkulkarni
 
PPT
Hibernate presentation
Manav Prasad
 
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
 
ODP
Hibernate Developer Reference
Muthuselvam RS
 
PPTX
Slideshare ppt
Mandy Suzanne
 
02 Hibernate Introduction
Ranjan Kumar
 
Introduction to Spring Framework
Raveendra R
 
Hibernate
reddivarihareesh
 
THE WORLDS NO.1 BLACK MAGIC EXPERT WITH POWERFUL LOVE SPELLS +27631229624
mamaalphah alpha
 
Hibernate an introduction
joseluismms
 
Introduction To Hibernate
ashishkulkarni
 
Hibernate presentation
Manav Prasad
 
Introduction to hibernate
Muhammad Zeeshan
 
Hibernate ORM: Tips, Tricks, and Performance Techniques
Brett Meyer
 
Java Hibernate Programming with Architecture Diagram and Example
kamal kotecha
 
Hibernate Developer Reference
Muthuselvam RS
 
Slideshare ppt
Mandy Suzanne
 
Ad

Similar to Introduction to Hibernate Framework (20)

PPTX
1_JavIntro
SARJERAO Sarju
 
PDF
An Overview of Entity Framework
iFour Technolab Pvt. Ltd.
 
PPT
Eclipse Day India 2011 - Extending JDT
deepakazad
 
PPTX
Spring FrameWork Tutorials Java Language
Mahika Tutorials
 
PPT
JDBC
Ankit Desai
 
PPT
YDP_API&MS_UNIT_IIIii8iiiiiiiii8iiii.ppt
NikhilBoda
 
PPT
YDP_API&MS_UNIT_hiii detail notes to understand api.ppt
NikhilBoda
 
PPT
jdbc_presentation.ppt
DrMeenakshiS
 
PPTX
Real World MVC
James Johnson
 
PDF
hibernate-presentation-1196607644547952-4.pdf
Mytrux1
 
PPTX
MVC and Entity Framework
James Johnson
 
PPTX
Overview of entity framework by software outsourcing company india
Jignesh Aakoliya
 
PPTX
The Best Way to Become an Android Developer Expert with Android Jetpack
Ahmad Arif Faizin
 
PDF
Data access
Joshua Yoon
 
PDF
inf5750---lecture-2.-c---hibernate-intro.pdf
bhqckkgwglxjcuctdf
 
PPTX
Тарас Олексин - Sculpt! Your! Tests!
DataArt
 
PPT
Hibernate
Murali Pachiyappan
 
PDF
Hibernate presentation
Luis Goldster
 
PDF
Intake 37 ef2
Mahmoud Ouf
 
1_JavIntro
SARJERAO Sarju
 
An Overview of Entity Framework
iFour Technolab Pvt. Ltd.
 
Eclipse Day India 2011 - Extending JDT
deepakazad
 
Spring FrameWork Tutorials Java Language
Mahika Tutorials
 
YDP_API&MS_UNIT_IIIii8iiiiiiiii8iiii.ppt
NikhilBoda
 
YDP_API&MS_UNIT_hiii detail notes to understand api.ppt
NikhilBoda
 
jdbc_presentation.ppt
DrMeenakshiS
 
Real World MVC
James Johnson
 
hibernate-presentation-1196607644547952-4.pdf
Mytrux1
 
MVC and Entity Framework
James Johnson
 
Overview of entity framework by software outsourcing company india
Jignesh Aakoliya
 
The Best Way to Become an Android Developer Expert with Android Jetpack
Ahmad Arif Faizin
 
Data access
Joshua Yoon
 
inf5750---lecture-2.-c---hibernate-intro.pdf
bhqckkgwglxjcuctdf
 
Тарас Олексин - Sculpt! Your! Tests!
DataArt
 
Hibernate presentation
Luis Goldster
 
Intake 37 ef2
Mahmoud Ouf
 

More from Collaboration Technologies (15)

PPTX
Introduction to Core Java Programming
Collaboration Technologies
 
PPTX
Introduction to Database SQL & PL/SQL
Collaboration Technologies
 
PPTX
Introduction to Advanced Javascript
Collaboration Technologies
 
PPTX
Introduction to AngularJS
Collaboration Technologies
 
PPTX
Introduction to Bootstrap
Collaboration Technologies
 
PPTX
Introduction to HTML4
Collaboration Technologies
 
PPTX
Introduction to HTML5
Collaboration Technologies
 
PPTX
Introduction to JavaScript Programming
Collaboration Technologies
 
PPTX
Introduction to Perl Programming
Collaboration Technologies
 
PPTX
Introduction to PHP
Collaboration Technologies
 
PPTX
Introduction to Python Basics Programming
Collaboration Technologies
 
PPTX
Introduction to Spring Framework
Collaboration Technologies
 
PPTX
Introduction to Struts 2
Collaboration Technologies
 
PPTX
Introduction to JSON & AJAX
Collaboration Technologies
 
PPTX
Introduction to Node.JS
Collaboration Technologies
 
Introduction to Core Java Programming
Collaboration Technologies
 
Introduction to Database SQL & PL/SQL
Collaboration Technologies
 
Introduction to Advanced Javascript
Collaboration Technologies
 
Introduction to AngularJS
Collaboration Technologies
 
Introduction to Bootstrap
Collaboration Technologies
 
Introduction to HTML4
Collaboration Technologies
 
Introduction to HTML5
Collaboration Technologies
 
Introduction to JavaScript Programming
Collaboration Technologies
 
Introduction to Perl Programming
Collaboration Technologies
 
Introduction to PHP
Collaboration Technologies
 
Introduction to Python Basics Programming
Collaboration Technologies
 
Introduction to Spring Framework
Collaboration Technologies
 
Introduction to Struts 2
Collaboration Technologies
 
Introduction to JSON & AJAX
Collaboration Technologies
 
Introduction to Node.JS
Collaboration Technologies
 

Recently uploaded (20)

PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
PPTX
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PPT
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PPTX
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
DevOps & Developer Experience Summer BBQ
AUGNYC
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Software Development Company | KodekX
KodekX
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PPTX
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
Software Development Methodologies in 2025
KodekX
 
DevOps & Developer Experience Summer BBQ
AUGNYC
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Software Development Company | KodekX
KodekX
 
This slide provides an overview Technology
mineshkharadi333
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 

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