views:

1111

answers:

6

I are using EJB 3 on a fairly large J2EE project, by default with Netbeans sets the persistent provider for the entity beans to TopLink. There is the option to change the provider to one of the following or even add a new persistence library:

  • Hibernate
  • KODO
  • OpenJPA

Which persistence provider do you prefer to use? What are the benefits of using the another provider?

While TopLink seems to be good, I can't find much good documentation on how to control caching etc. Any help would be much appreciated.

+2  A: 

I would strongly recommend Hibernate for the following reasons:

  • The most widely used and respected open source persistence layer in the Java world; huge active community and lots of use in high volume mission critical applications.
  • You don't tie yourself to J2EE or a specific vendor at all should you wish to go a different route with the rest of your application, such as Spring, etc, as Hibernate will still play nice.
Pete
+2  A: 

I've found Hibernate to be fairly well documented, and well supported by the various caching technologies. I've also used it quite a bit more than the others in non-JPA contexts, so perhaps I'm a bit biased towards it because of that.

The few little toy projects that I've tried with TopLink Essentials worked out pretty well also, but I never got into caching or anything that would require provider specific documentation. In general, I think there's less community support for that, which is part of why I end up using Hibernate.

jsight
+1  A: 

I use Hibernate. It's very mature and works very nicely. I personally haven't used any of the others, but I do know that Hibernate is one of the most fully featured JPA providers out there. Also because so many people are using it, just about every problem I've had with it, I can quickly find an solution with a little bit of googling.

+6  A: 

Theres only two JPA providers I'd consider using:

If you want to stick to standard JPA I'd use EclipseLink. Whereas Toplink Essentials is the reference implementation of JPA 1.0, EclipseLink basically inherited the TopLink Essentials code and will be the reference implementation of JPA 2.0 (and bundled with Glassfish V3 when it ships; expected around JavaOne in May 2009). TopLink Essentials was a somewhat crippled version of Oracle's commercial TopLink product but EclipseLink basically has all the features TopLink has.

The other choice is obviously Hibernate. Its widely used and mature but is not issue free from what I've seen. For example, last I looked Hibernate has issues with an entity having multiple one-to-many eager relationships. I don't know if Hibernate has an equivalent to EclipseLink's batch query hint, but its an incredibly useful feature to deal with this kind of problem.

Hibernate of course also supports standard JPA. The biggest advantage of Hibernate is that if you have question about how it works a google search is likely to find you an answer.

I honestly wouldn't consider anything other than the above two providers.

cletus
A: 

I recently worked on a large enterprise application built with Kodo JPA framework. The SQLs produced by Kodo were generally not very scalable with large amount of data. In my opinion it produced too many queries with outer joins. Considering how many mappings we had to change when trying to scale kodo, I would not recommend using it for a large enterprise application. Even the Oracle representatives we talked to are trying to wean customers away from kodo onto TopLink. Oracle may phase out kodo in the future.

GotoError
A: 

DataNucleus http://www.datanucleus.org is also a fully-compliant JPA provider, with JPA1 and some preview JPA2 features

DataNucleus