Hibernate or EclipseLink for JPA? [closed]
开发者_开发问答
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this questionI was wondering if anyone has experience with the JPA2.0 implementation of any of those frameworks? Especially together with Spring3.x which comes with EclipseLink support.
Do you use any of those frameworks and JPA2.0 for production? Any severe issues?
EclipseLink is more standards compliant, since it is the reference implementation for JPA 2, Hibernate has some compliancy issues, but is more mature.
One of the main benefits of EclipseLink is that you can call native SQL functions directly in your JPQL queries. In Hibernate this is not directly possible.
But Hibernate has a bigger community, better documentation and also better error messages.
IMHO It is always better to use a standard api where possible. Your own example shows this perfectly. You were able to try your identical code on two providers when one failed to work as expected. Switching to any native API prevents you from doing this.
If using EclipseLink as your JPA 2.0 provider works well for you, then use it. If you do happen to run into an issue, file an EclipseLink bug, and get help on this forum, or the EclipseLink forums and Newsgroups.
From my experience, with Java Perf Profiling. My apps built using Eclipselink seem to perform a lot better than with Hibernate both in Data insertion and retrieval. Hibernate however is more widely used and provides a bigger forum for support.
In production, I will simply take Hibernate for this reason.
Just pick and stick with one. Standards are just in the end guidelines and every implementer can implement or fail to implement the standards accordingly.
e.g.
EclipseLink has issues using something basic such as JPA
@Converter
s though supposedly recently fixed through IBM http://www-01.ibm.com/support/docview.wss?uid=swg1PI73277Hibernate's JPQL implementation does not understand boolean values that stand on their own more specifically I had to change my JPQL to say
from Participant p where not p.cancelled
to
from Participant p where p.cancelled = false
The other thing is you're building things in Spring and you're likely going to do the improper but common approach of changing the class loader to PARENT_LAST
order so your classes are used rather than the application servers.
If you plan to do the proper way and use the JPA that comes with the application server just be a bit wary in that your Application Server implementation may be buggy.
Transaction wise your application, specifically Spring must handle things for you.
精彩评论