Differnce Between JDBC and Hibernate and Hibernate Introduction
Differnce Between JDBC and Hibernate and Hibernate Introduction
What is
JDBC?
JDBC stands for Java Database Connectivity. It is a free open source application programming
interface for Java which enables the application to access the database. It enables the developers
to create queries, update data to the relational database using a Structured Query
Language (SQL).
JDBC Workflow
What is ORM?
ORM is a new kind of persistence Software, which acts like a bridge between Java application
and database and transfers to or form data in the form of objects.
ORM softwares internally uses JDBC, JNDI and JTA(Java transaction API) for
communicating a java application with a database in order to transfer objects between them.
An ORM softwares uses JDBC technology to perform database operations with it.
An ORM softwares uses JNDI when connection pooling technique is applied for obtaing
database connections and JTA is used while managing the database transactions.
Primary fuctionality of all ORM softwares is same i.e. data transfer will be done in form of
objects and the persistance logic is independent of all the databases.
What is Hibernate?
Hibenate is an open source frame work, also called as an ORM tool and it acts as middle layer
between a java application and database and provides persistance and query service in the
form of objects.
Hibernate is a free open source object-relational mapping library for Java which is designed to
map objects to an RDBMS and to implement the object-oriented programming concepts in a
relational database.
Hibernate acts as a abstraction layer on top of JDBC technology.
Hibernate Workflow
1. Unlike JDBC Hibernate connects with the database itself and uses HQL (Hibernate Query
Language) to execute the queries and then it maps the results to the Java objects.
2. The results are mapped to objects based on the properties given in the Hibernate
configuration XML file.