SlideShare a Scribd company logo
JPA /
HIBERNATE
Sagar Verma
Sr.Software Engineer
Ad. JAVA
Object-Relational Mapping
• It is a programming technique for converting
object-type data of an object oriented
programming language into database tables.
• Hibernate is used convert object data in JAVA
to relational database tables.
What is Hibernate?
• It is open source object-relational mapping
(ORM) for Java.
• Hibernate is responsible for making data
persistent by storing it in a database.
Why Hibernate and not JDBC?
• JDBC maps Java classes to database tables (and from Java
data types to SQL data types)
• Hibernate automatically generates the SQL queries.
• Hibernate provides data query and retrieval facilities and can
significantly reduce development time as more time is
required to manually handle data in SQL and JDBC.
• It makes an application portable to all SQL databases.
Architecture
Hibernate sits between your
code and the database
Maps persistent objects to
tables in the database
Hibernate
• Configuration Object:
– The Configuration object is the first Hibernate object you create in any Hibernate
application and usually created only once during application initialization. The
Configuration object provides two keys components:
– Database Connection: This is handled through one or more configuration files
supported by Hibernate. These files are hibernate.properties and hibernate.cfg.xml.
– Class Mapping Setup
This component creates the connection between the Java classes and database tables.
• SessionFactory Object:
– Configuration object is used to create a SessionFactory object which inturn configures
Hibernate for the application using the supplied configuration file and allows for a
Session object to be instantiated.
– SessionFactory is a thread safe object and used by all the threads of an application.
– The SessionFactory is heavyweight object so usually it is created during application start
up and kept for later use.
– You would need one SessionFactory object per database using a separate configuration
file. So if you are using multiple databases then you would have to create multiple
SessionFactory objects.
Hibernate
• Session Object:
– A Session is used to get a physical connection with a database.
– It is lightweight and designed to be instantiated each time an interaction is
needed with the database. Persistent objects are saved and retrieved through a
Session object.
– The session objects should not be kept open for a long time because they are not
usually thread safe and they should be created and destroyed as needed.
• Transaction Object:
– A Transaction represents a unit of work with the database and most of the RDBMS
supports transaction functionality. Transactions in Hibernate are handled by an
underlying transaction manager and transaction (from JDBC or JTA).
– This is an optional object and Hibernate applications may choose not to use this
interface, instead managing transactions in their own application code.
• Query Object:
– Query objects use SQL or Hibernate Query Language (HQL) string to retrieve data
from the database and create objects. A Query instance is used to bind query
parameters and to execute the query.
WEB SERVICE
History of Web Service
• Structured programming
• Object-oriented programming
• Distributed computing
• Electronic data interchange
• World Wide Web
• Web services
What is Web Service?
• Web service is a standardized medium to
propagate communication between the client
and server applications on the World Wide Web.
• Web services provide a common platform that
allows multiple applications built on various
programming languages to have the ability to
communicate with each other
Architecture of Web Service
Type of Web Service?
• SOAP:
SOAP is known as the Simple Object Access Protocol.
SOAP was developed as an intermediate language so that
applications built on various programming languages could talk
quickly to each other and avoid the extreme development effort.
• WSDL:
WSDL is known as the Web Services Description Language(WSDL).
WSDL is an XML-based file which tells the client application what
the web service does and gives all the information required to
connect to the web service.
• REST:
REST stands for Representational State Transfer.
REST is used to build Web services that are lightweight,
maintainable, and scalable.
Advantage of Web Service?
• Exposing Business Functionality on the
network
• Interoperability amongst applications
• A Standardized Protocol which
everybody understands
• Reduction in cost of communication
Web Service Characteristics
• They are XML-Based
• Loosely Coupled
• Synchronous or
Asynchronous functionality
• Ability to support Remote Procedure
Calls (RPCs)
• Supports Document Exchange
Example
Soap Web service Rest Web service
References
• www.hibernate.org
• http://www.tutorialspoint.com/hibernate/hiberna
• https://www.javatpoint.com/web-services-tutoria
Thank You !!!
Feel free for asking a question
-- Sagar Verma

More Related Content

PPTX
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
PPSX
Elements of Java Language
PDF
Core Java
PPTX
Introduction to JAVA
PPT
Java introduction
PPSX
Core java lessons
PPT
Java basic
PPTX
Core Java introduction | Basics | free course
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
Elements of Java Language
Core Java
Introduction to JAVA
Java introduction
Core java lessons
Java basic
Core Java introduction | Basics | free course

What's hot (18)

PPT
Presentation on java
PPTX
Java 101 Intro to Java Programming
PPTX
Core Java
PPTX
Core java
PDF
Basic java tutorial
PDF
Java - OOPS and Java Basics
PDF
Top 10 Java Interview Questions and Answers 2014
PDF
Introduction to Java Programming
PDF
Top 100 Java Interview Questions with Detailed Answers
PPT
Basic java part_ii
PDF
Introduction to Java
PPSX
Java & advanced java
PDF
Core Java Tutorial
PDF
Core Java Introduction | Basics
PDF
What Is Java | Java Tutorial | Java Programming | Learn Java | Edureka
PPTX
Java training in delhi
PDF
Java Interview Questions
ZIP
Introduction to the Java(TM) Advanced Imaging API
Presentation on java
Java 101 Intro to Java Programming
Core Java
Core java
Basic java tutorial
Java - OOPS and Java Basics
Top 10 Java Interview Questions and Answers 2014
Introduction to Java Programming
Top 100 Java Interview Questions with Detailed Answers
Basic java part_ii
Introduction to Java
Java & advanced java
Core Java Tutorial
Core Java Introduction | Basics
What Is Java | Java Tutorial | Java Programming | Learn Java | Edureka
Java training in delhi
Java Interview Questions
Introduction to the Java(TM) Advanced Imaging API
Ad

Similar to Hibernate introduction (20)

PDF
Free Hibernate Tutorial | VirtualNuggets
PDF
Hibernate 3
PPT
2010 05-21, object-relational mapping using hibernate v2
PPTX
Module-3 for career and JFSD ppt for study.pptx
PPT
Basic Hibernate Final
PPTX
Hibernate tutorial
PPTX
Hibernate in Action
PPT
PDF
Hibernate presentation
PDF
hibernate-presentation-1196607644547952-4.pdf
PPTX
Hibernate in XPages
PDF
What is hibernate?
PPT
DOCX
What is hibernate?
PPT
Hibernate training-topics
PPTX
Hibernate
PPT
Hibernate
PPTX
Hibernate ppt
PDF
Hibernate reference1
PDF
Hibernate Interview Questions
Free Hibernate Tutorial | VirtualNuggets
Hibernate 3
2010 05-21, object-relational mapping using hibernate v2
Module-3 for career and JFSD ppt for study.pptx
Basic Hibernate Final
Hibernate tutorial
Hibernate in Action
Hibernate presentation
hibernate-presentation-1196607644547952-4.pdf
Hibernate in XPages
What is hibernate?
What is hibernate?
Hibernate training-topics
Hibernate
Hibernate
Hibernate ppt
Hibernate reference1
Hibernate Interview Questions
Ad

More from Sagar Verma (8)

PPTX
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
PPTX
Statics in java | Constructors | Exceptions in Java | String in java| class 3
PPTX
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
PPT
Core Java Programming | Data Type | operator | java Control Flow| Class 2
PPT
Springboot introduction
PDF
2015-16 software project list
DOC
Ns2 new project list
PPT
Privacy preserving dm_ppt
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Statics in java | Constructors | Exceptions in Java | String in java| class 3
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
Core Java Programming | Data Type | operator | java Control Flow| Class 2
Springboot introduction
2015-16 software project list
Ns2 new project list
Privacy preserving dm_ppt

Recently uploaded (20)

PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
PDF
Understanding NFT Marketplace Development_ Trends and Innovations.pdf
PDF
Comprehensive Salesforce Implementation Services.pdf
PPTX
Presentation of Computer CLASS 2 .pptx
PPTX
How a Careem Clone App Allows You to Compete with Large Mobility Brands
PPTX
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
PDF
AI in Product Development-omnex systems
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
PDF
Convert Thunderbird to Outlook into bulk
PPTX
CRUISE TICKETING SYSTEM | CRUISE RESERVATION SOFTWARE
PDF
System and Network Administraation Chapter 3
PPTX
Mastering-Cybersecurity-The-Crucial-Role-of-Antivirus-Support-Services.pptx
PPT
JAVA ppt tutorial basics to learn java programming
PPTX
Benefits of DCCM for Genesys Contact Center
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Save Business Costs with CRM Software for Insurance Agents
PDF
Forouzan Book Information Security Chaper - 1
A REACT POMODORO TIMER WEB APPLICATION.pdf
Understanding NFT Marketplace Development_ Trends and Innovations.pdf
Comprehensive Salesforce Implementation Services.pdf
Presentation of Computer CLASS 2 .pptx
How a Careem Clone App Allows You to Compete with Large Mobility Brands
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
AI in Product Development-omnex systems
Upgrade and Innovation Strategies for SAP ERP Customers
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
Convert Thunderbird to Outlook into bulk
CRUISE TICKETING SYSTEM | CRUISE RESERVATION SOFTWARE
System and Network Administraation Chapter 3
Mastering-Cybersecurity-The-Crucial-Role-of-Antivirus-Support-Services.pptx
JAVA ppt tutorial basics to learn java programming
Benefits of DCCM for Genesys Contact Center
How to Migrate SBCGlobal Email to Yahoo Easily
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
How Creative Agencies Leverage Project Management Software.pdf
Save Business Costs with CRM Software for Insurance Agents
Forouzan Book Information Security Chaper - 1

Hibernate introduction

  • 2. Object-Relational Mapping • It is a programming technique for converting object-type data of an object oriented programming language into database tables. • Hibernate is used convert object data in JAVA to relational database tables.
  • 3. What is Hibernate? • It is open source object-relational mapping (ORM) for Java. • Hibernate is responsible for making data persistent by storing it in a database.
  • 4. Why Hibernate and not JDBC? • JDBC maps Java classes to database tables (and from Java data types to SQL data types) • Hibernate automatically generates the SQL queries. • Hibernate provides data query and retrieval facilities and can significantly reduce development time as more time is required to manually handle data in SQL and JDBC. • It makes an application portable to all SQL databases.
  • 5. Architecture Hibernate sits between your code and the database Maps persistent objects to tables in the database
  • 6. Hibernate • Configuration Object: – The Configuration object is the first Hibernate object you create in any Hibernate application and usually created only once during application initialization. The Configuration object provides two keys components: – Database Connection: This is handled through one or more configuration files supported by Hibernate. These files are hibernate.properties and hibernate.cfg.xml. – Class Mapping Setup This component creates the connection between the Java classes and database tables. • SessionFactory Object: – Configuration object is used to create a SessionFactory object which inturn configures Hibernate for the application using the supplied configuration file and allows for a Session object to be instantiated. – SessionFactory is a thread safe object and used by all the threads of an application. – The SessionFactory is heavyweight object so usually it is created during application start up and kept for later use. – You would need one SessionFactory object per database using a separate configuration file. So if you are using multiple databases then you would have to create multiple SessionFactory objects.
  • 7. Hibernate • Session Object: – A Session is used to get a physical connection with a database. – It is lightweight and designed to be instantiated each time an interaction is needed with the database. Persistent objects are saved and retrieved through a Session object. – The session objects should not be kept open for a long time because they are not usually thread safe and they should be created and destroyed as needed. • Transaction Object: – A Transaction represents a unit of work with the database and most of the RDBMS supports transaction functionality. Transactions in Hibernate are handled by an underlying transaction manager and transaction (from JDBC or JTA). – This is an optional object and Hibernate applications may choose not to use this interface, instead managing transactions in their own application code. • Query Object: – Query objects use SQL or Hibernate Query Language (HQL) string to retrieve data from the database and create objects. A Query instance is used to bind query parameters and to execute the query.
  • 9. History of Web Service • Structured programming • Object-oriented programming • Distributed computing • Electronic data interchange • World Wide Web • Web services
  • 10. What is Web Service? • Web service is a standardized medium to propagate communication between the client and server applications on the World Wide Web. • Web services provide a common platform that allows multiple applications built on various programming languages to have the ability to communicate with each other
  • 12. Type of Web Service? • SOAP: SOAP is known as the Simple Object Access Protocol. SOAP was developed as an intermediate language so that applications built on various programming languages could talk quickly to each other and avoid the extreme development effort. • WSDL: WSDL is known as the Web Services Description Language(WSDL). WSDL is an XML-based file which tells the client application what the web service does and gives all the information required to connect to the web service. • REST: REST stands for Representational State Transfer. REST is used to build Web services that are lightweight, maintainable, and scalable.
  • 13. Advantage of Web Service? • Exposing Business Functionality on the network • Interoperability amongst applications • A Standardized Protocol which everybody understands • Reduction in cost of communication
  • 14. Web Service Characteristics • They are XML-Based • Loosely Coupled • Synchronous or Asynchronous functionality • Ability to support Remote Procedure Calls (RPCs) • Supports Document Exchange
  • 15. Example Soap Web service Rest Web service
  • 16. References • www.hibernate.org • http://www.tutorialspoint.com/hibernate/hiberna • https://www.javatpoint.com/web-services-tutoria
  • 17. Thank You !!! Feel free for asking a question -- Sagar Verma