Hibernate vs JPA

The term “software development” has a lot of different abbreviations, especially when we are talking about Java development. Every day, reading any IT-portal you can see something like this: EJB, JSF, GWT, JSTL, POJO, JPA… Sometimes it seems hard to keep track of all rapidly changing technologies. So today I’m going to clarify all the aspects of JPA and Hibernate.

In the modern software development world OOP became a usual guest. And it’s easy to explain – in programming, everything from real life can be presented like an object. For example, we can look at any car and create an appropriate object for it. The object will contain all needed information such as color, weight, engine, brand and model…
In this way it’s possible to represent any object with the help of OOP, but what about storing of object collections? Yeah, you are right, database suits for this purpose better than anything else. Databases have their own data types which do not always correspond to data types of programming languages. In order to avoid routine management of data type mapping you can delegate this rask to ORM.

This is not the end of the prelude, so let’s continue. In 2006 JPA was firstly introduced in Java 1.5. Java Persistence API is a specification (interface) for the persistence of domain objects. Roughly speaking, JPA is a set of methods without implementation. This set provides everything you need to organize the mapping of objects to database tables, CRUD operations, managing transactions.
Meanwhile, Hibernate is one of the implementations of JPA. It contains all the method’s realizations and even extends the set of methods with its own.

Summary

The question about “the difference between JPA and Hibernate” is incorrect. Battle Hibernate vs JPA is pointless.
It’s advisable to use any implementation of JPA with JPA API in order avoid implementing different ORM.

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS