Hibernate vs EclipseLink

3

Both persistence frameworks implement JPA.

1 - Is there a difference between the two?

2 - Which is the best in performance?

3 - How do the two implement the same specification, after developing a complete application is it possible to change from one framework to another without major changes to the source code?

    
asked by anonymous 21.03.2017 / 15:34

3 answers

1

Both persistence frameworks implement JPA.

1 - Is there a difference between the two? Yes, there are differences. However, common sense understands that the purpose is the same: both implement JPA Specification . Home Hibernate was born without JPA but today it is common to access Hibernate by the JPA specification: Hibernate from JBoss, EclipseLink from the Eclipse Foundation and OpenJPA from Apache. Although Hibernate originated JPA, EclipseLink is the referential implementation. [ Hibernate - ORM Frameworks ]

2 - Which is the best in performance?
EclipseLink provides much more sophisticated and exotic layers and cache features, as isolated caching to support virtual private database (virtual private database - vpd). And there's more. In EclipseLink's case, it has a fully integrated shared object cache, so not only is local persistence context management efficient, but all threads on the same server can also benefit from shared cache content. [ Pro JPA 2 ]

3 - How do the two implement the same specification, after developing a complete application is it possible to change from one framework to another without needing major changes to the source code? In theory, yes, it should. The main query language is Java Persistence Query Language (JP QL), a database-independent query language that operates on the logical entity model as opposed to the physical data model. But in practice it will depend on the native SQL dialect used in the lines of code (not recommended). Before languages like JP QL became standardized, the most common method for building queries on many persistence providers was through a programming API. The query framework in EclipseLink, for example, was the most effective way to truly unlock the full power of your query engine. And even with the advent of JP QL, the programming APIs still remained in use to give access to resources not yet supported by the default query language. [ Pro JPA 2 ]

I think that's it, and sorry if I was somehow biased. It was not my intention.

References:

[ JPA Specification ]. Available at JSR-000338 : Java (tm) Persistence Specification . Access: 31 Mar 2017.

[ Hibernate - Frameworks ORM ]. Available in #

A Practical Introduction to JPA with Hibernate . Access: 31 Mar 2017.

[ Pro JPA 2 ]. Available at Pro JPA 2 - A Definitive Guide to Mastering the Java Persistence API . Access: 31 Mar 2017.

    
31.03.2017 / 07:39
2
  • Yes there are differences in behavior between the two, but only where the specification does not clarify what should be done, follow the links for more information. link link
  • In general, Hibernate tends to perform succinctly better, follow the link with a comparison. link
  • In general you should change little code, but specific behaviors of switching from one to another may end up preaching some parts, such as the Hibernete ID, filled out after calling EclipseLink methods only when registration is sent to the DB.
  • 30.03.2017 / 12:22
    0

    Hibernate is more robust, consumes more memory and therefore can be considered heavier, but in extreme conditions it is more efficient doing many more inserts and queries per minute. Use it on projects where you have a robust server and simultaneous access is great.

    Toplink and Eclipselink are for simpler projects. They are more memory-intensive and great for JPA learning because it will hardly slow down your machine, but they can not handle the hassle that Hibernate can handle at critical times on a production server.

    This is not just my opinion based on personal experience. I've heard the same comments from other programmers and post teachers. In the link below the author of the post did some tests that corroborate this perception of Eclipselink and Toplink being less robust than Hibernate: link

    In terms of use, everyone uses JPA and if you do not use any specific functionality of an implementation, to change you will only need to change properties in persistence xml and half a dozen imports.

        
    04.04.2017 / 02:59