There are some key points about Hibernate
- It is an ORM (Object Relational Mapping) framework.
- It implements JPA (Java Persistence API).
JPA is a set of standards that have been described for implement any persistence in software.
There is a main drawback in persisting data through an application. Let’s think of a scenario that we use a relational database for persisting data and java as the programming language. In our application we need to store details of our users So there will be a user class in code.
And there
will be corresponding table in the database.
So when data
persisting in to database through our application there are several things need
to be done.
- Make connection to database.
- Pull up all the data fields from the object.
- Create a SQL query with data to insert into database.
- Finally execute the SQL query.
So the
conversion between Java objects and SQL queries has to be done every time when
retrieve and persist data.
In this
approach we have problems with Mapping member variables to columns, mapping
relationships, Handling data types and managing changes to object states. So it is
better to use a framework that follows standards so that we don’t have to deal
with above problems over and over again. So hibernate is that kind of life
saving framework for java developers. Though Hibernate is popular there are
other frameworks as well that do the same object relational mapping.
No comments:
Post a Comment