Organizational Research By

Surprising Reserch Topic

which are the differences similarities between hibernate and other frameworks or


which are the differences similarities between hibernate and other frameworks or  using -'hibernate,jpa,java-ee,persistence,java-ee-5'

I want to know the differences/similarities between Hibernate and simple persistence in Java EE 5?

I'm not clear if Hibernate implements Java EE 5 persistence implementation or if it is a totally different approach to data representation over back-end systems.

I'm confused about Hibernate and its relation with the concepts about java persistence given in the Java EE 5 tutorial... could you clarify the role of Hibernate in the context of Entities and EJBs?

Also, I want to know other approaches (frameworks) like JPA or Spring...
    

asked Oct 7, 2015 by vijayshukla80
0 votes
4 views



Related Hot Questions

5 Answers

0 votes

I want to know the differences/similarities between Hibernate and simple persistence in Java EE 5?

The standardized persistence API of Java EE 5 is JPA 1.0 and is a kind of unified version of EJB 2 CMP, JDO, Hibernate, and TopLink APIs and products. Hibernate is an ORM framework that predates JPA and has heavily influenced the specification of JPA (the creator of Hibernate is a member of the expert group behind JPA). Just keep in mind that JPA is just an API, you need an implementation of JPA to use it.

I'm not clear if Hibernate implements Java EE 5 persistence implementation or if it is a totally different approach to data representation over back-end systems.

Yes, Hibernate provides an implementation of JPA (and also extends it, Hibernate is a superset of JPA) via the Hibernate EntityManager project (that relies on Hibernate Core).

I'm confused about Hibernate and its relation with the concepts about java persistence given in the Java EE 5 tutorial... could you clarify the role of Hibernate in the context of Entities and EJBs?

Hibernate can be used as the JPA persistence provider, i.e. as the piece of code that actually persists EJB 3 entities (the JPA specification was part of EJB 3.0 specification in version 1.0, it's now a separate spec)

Also, I want to know other approaches (frameworks) like JPA or Spring...

Spring is not a persistence framework, Spring is an IoC container, it doesn't compete with Hibernate.

JPA compliant alternatives to Hibernate include TopLink Essentials (the RI in Java EE 5), EclipseLink (which is also the RI of JPA 2.0 in Java EE 6), OpenJPA, DataNucleus.

Other options for persistence include JDO (another standardized persistence API), iBATIS (not an ORM, it's more a data mapper), JDBC (low level API) to cite the most famous.

Check this previous answer for an overview and some historical background.

answered Oct 7, 2015 by loknath.ganji
0 votes

Check this diagram from http://www.hibernate.org:

alt text

In the past, during the ancient J2EE days, Hibernate was a major player in the persistence world. There were competitors, but the persistence code was not exchangeable. Later when Java EE 5, the successor of J2EE, was in development, the new Java Persistence API (JPA) was specified with help of the lead guy of Hibernate, Gavin King, with the goal to abstract the persistence more and specify it in a single contract. This way one can easily choose and exchange between the JPA implementation without changing the code (like as with the JDBC API). As far now there are under each Hibernate JPA, EclipseLink (formerly known as TopLink) and OpenJPA as JPA implementations.

I think your confusion is actually between the "Good Old" Hibernate and the modern Hibernate JPA. Hopefully that's now cleared up.

answered Oct 7, 2015 by ashishshukla
0 votes

When JPA (Java EE 5 persistence standard) was developed by the JCP expert group (JSR 220) a lot of ideas have been taken from the existing Hibernate (also from JDO). Gavin King the founder of Hibernate himself has been part of the expert group among others.

After the final JPA specification was published Hibernate became an open source implementation of it (since version 3.2). Hibernate still has a richer feature set and usually generates new features faster as an open-source development process tend to be faster then a Java community process.

Other implementations of JPA are:

  • DataNucleus
  • EclipseLink
  • OpenJPA

Other approaches are:

  • JDO
  • iBatis
  • plain JDBC
answered Oct 7, 2015 by vijayshukla80
0 votes

The JPA specification described in EE5 is just an specification. This means that it is not a product. JPA is just a set of definitions that the different providers have to accomplish to be "JPA complaint"

Hibernate is just another "plugable" persistence provider, this means that this product implements the definitions given by JPA specification. You can find other similar products like TopLink or Apache's OpenJPA.

That is it.

answered Oct 7, 2015 by ankitarajoria4
0 votes

Slightly off topic but JPA implies a "session orientated" architecture. That is your beans are attached/detached to an EntityManager and you persist/merge/flush the entityManager.

If you are looking for a "sessionless" approach to ORM (no attached/detached persist/merge/flush) then you can also look at Ebean ORM which also uses JPA Annotations for mapping. You could also describe this as "Ebean provides automatic management of the Persistence Context".

answered Oct 7, 2015 by vimaldas2005

...