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.
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