Compare the Difference Between Similar Terms

Difference Between

Home / Technology / IT / Applications / Difference Between JPA and Hibernate

Difference Between JPA and Hibernate

July 31, 2011 Posted by Indika

JPA vs Hibernate

Almost all of enterprise applications are required to access relational databases regularly. But a problem faced with earlier technologies (such as JDBC) was the impedance mismatch (difference between object-oriented and relational technologies). A solution for this problem was introduced through the introduction of an abstract layer called Persistence layer, which encapsulates database access from the business logic. JPA (Java Persistence API) is a framework dedicated for the management of relational data (using the persistence layer) in Java applications. There are many vendor implementations of JPA used within the Java developer community. Hibernate is the most popular such implementation of JPA (DataNucleus, EclipseLink and OpenJPA are some others). The newest JPA version (JPA 2.0) is fully supported by Hibernate 3.5, which was released in March, 2010.

What is JPA?

JPA is a framework for managing relational data for Java. It can be used with applications utilizing JSE (Java Platform, Standard Edition) or JEE (Java Platform, Enterprise Edition). Its current version is JPA 2.0, which was released on 10 Dec, 2009. JPA replaced EJB 2.0 and EJB 1.1 entity beans (which were heavily criticized for being heavyweight by the Java developer community). Although entity beans (in EJB) provided persistence objects, many developers were used to utilizing relatively lightweight objects offered by DAO (Data Access Objects) and other similar frameworks instead. As a result, JPA was introduced, and it captured many of the neat features of the frameworks mentioned above.

Persistence as described in JPA covers the API (defined in javax.persistence), JPQL (Java Platform, Enterprise Edition) and metadata required for relational objects. State of a persistence entity is typically persisted in to a table. Instances of an entity correspond to rows of the table of the relational database. Metadata is used to express the relationships between entities. Annotations or separate XML descriptor files (deployed with the application) are used to specify metadata in entity classes. JPQL, which is similar to SQL queries, are used to query stored entities.

What is Hibernate?

Hibernate is a framework that can be used for object-relational mapping intended for Java programming language. More specifically, it is an ORM (object-relational mapping) library that can be used to map object-relational model in to conventional relational model. In simple terms, it creates a mapping between Java classes and tables in relational databases, also between Java to SQL data types. Hibernate can also be used for data querying and retrieving by generating SQL calls. Therefore, the programmer is relieved from the manual handling of result sets and converting objects. Hibernate is released as a free and open source framework distributed under GNU license. An implementation for JPA API is provided in Hibernate 3.2 and later versions. Gavin King is the founder of Hibernate.

What is the difference between JPA and Hibernate?

JPA is a framework for managing relational data in Java applications, while Hibernate is a specific implementation of JPA (so ideally, JPA and Hibernate cannot be directly compared). In other words, Hibernate is one of the most popular frameworks that implements JPA. Hibernate implements JPA through Hibernate Annotation and EntityManager libraries that are implemented on top of Hibernate Core libraries. Both EntityManager and Annotations follow the lifecycle of Hibernate. The newest JPA version (JPA 2.0) is fully supported by Hibernate 3.5. JPA has the benefit of having an interface that is standardized, so the developer community will be more familiar with it than Hibernate. On the other hand, native Hibernate APIs can be considered more powerful because its features are a superset of that of JPA.

Related posts:

Difference Between EJB2 and EJB3 Difference Between J2SE and J2EE Difference Between Java5 and Java6 Difference Between Adobe Illustrator and Adobe Photoshop Difference Between Clipping and Culling

Filed Under: Applications Tagged With: Annotations, DAO, DataNucleus, EclipseLink, EJB, EJB 1.1, EJB 2.0, EntityManager, Gavin King, Hibernate, Hibernate 3.2, Hibernate 3.5, impedance mismatch, implementations of JPA, Java applications, Java Persistence API, JDBC, JEE, JPA, JPA 2.0, JPQL, JSE, metadata, OpenJPA, ORM library, Persistence layer

About the Author: Indika

Indika, BSc.Eng, MSECE Computer Engineering, PhD. Computer Science, is an Assistant Professor and has research interests in the areas of Bioinformatics, Computational Biology, and Biomedical Natural Language Processing.

Comments

  1. HOUSSEM ZAIER says

    December 19, 2011 at 5:13 pm

    Good stuf

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Request Article

Featured Posts

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and SARS

Difference Between Coronavirus and SARS

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Covid 19

Difference Between Coronavirus and Covid 19

You May Like

Difference Between Marble and Granite

What is the Difference Between Shuttle Vector and Expression Vector

What is the Difference Between Shuttle Vector and Expression Vector

Difference Between Jefferson and Jackson

Difference Between Acidic Salt and Basic Salt

Difference Between Acidic Salt and Basic Salt

Difference Between Hemoglobin and Hematocrit

Difference Between Hemoglobin and Hematocrit

Latest Posts

  • What is the Difference Between Osteoporosis and Scoliosis
  • What is the Difference Between Saree and Half Saree
  • What is the Difference Between Hypernatremia and Hyponatremia
  • What is the Difference Between Diabetes Mellitus and Diabetic Ketoacidosis
  • What is the Difference Between Sciatica and Spinal Stenosis
  • What is the Difference Between Metatarsalgia and Morton’s Neuroma
  • Home
  • Vacancies
  • About
  • Request Article
  • Contact Us

Copyright © 2010-2018 Difference Between. All rights reserved. Terms of Use and Privacy Policy: Legal.