views:

3755

answers:

4

Hi all,

I have made use of the following JPA implementations:

  1. Hibernate,
  2. Toplink,
  3. OpenJPA

Each of them has their own strengths and weaknesses. I found Hibernate the most advanced of the three except that it mixed some of its own enhancements with JPA which made it difficult to switch out to other providers. Most importantly, its query parser was much more lenient when interpreting JPA. They make it slightly difficult to get the correct libraries to support hibernate because I found it a mission trying to get the right versions of all the dependencies.

Toplink was ok but one is left with the feeling that it is slightly crippled as it seems Orcale wants you to use/buy? their more advanced library. Trying to download it was also a mission because you need to install it via running a jar file. I found that it implemented only the base JPA spec. The reason I used it was hibernate uses a lot of libraries that are commonly used in other open source projects that one would often get classloarder problems, especially when using JBoss

OpenJPA - This has by far the best documentation and is easy to download and use but it seems its very buggy. Maybe its just my code but code I found more advanced usage such as OneToMany relationships with CascadeType.all set just didn't seem to work. Admittedly It may be my code that was wrong and I haven't had time to test a clean case but many incidents like this leave me scared to use it. I really hope it gets better. Its error messages are often useless in helping solve the problem.

What other libraries have people used and which ones do they prefer and why?

+3  A: 

Duplicate of:

cletus
thanks for the feedback will have a look but none seem to mention openjpa from my initial scan.
mxc
The second link has OpenJPA right in the question description.
Rob Hruska
+5  A: 

I had the same conclusions about these implementations.

  1. OpenJPA was/seemed buggy

  2. Hibernate had tons of libraries and seemed to have trouble with not lazy loading everything.

  3. Toplink ended up as my choice. It was not as flexible as Hibernate would have been but it works and I don't have to install commons-logging.

The one I would try next is JPOX.

Clint
EclipseLink is (imho) better than all of those.
cletus
+1  A: 

Personally I don't feel OpenJPA is mature enough yet. There are other open source libraries that are more mature and I would rather use those. These are the ones I would consider in order:

  1. Hibernate. Hibernate has been around for a long time and has really paved the way for ORM in Java. The only issue I have with Hibernate is the licensing. It is LGPL licensed which may cause some commercial companies to squirm (for reasons I won't go into here). Anyway, if LGPL is an issue for you, it is probably good to steer clear.

  2. EclipseLink. Some background on eclipselink. Toplink Essentials was Oracle's free version of their JPA implementation. EclipseLink was taken from Toplink, Oracle's full blown JPA implementation. EclipseLink is going to be the JPA 2.0 provider for Glassfish v3.0 so it looks like everything is moving away from Toplink Essentials and to EclipseLink. Although the EclipseLink version is only 1.0.2, the product has been around for a long time under other names.

A project I'm working on is on Toplink Essentials right now but we plan to switch to Eclipselink shortly. Hibernate was out for the licensing issues I mentioned earlier.

Chris Dail
+2  A: 

Hey, guys, OpenJPA is known as Kodo, which is what BEA bought quite long ago. Kodo was implementation of JDO and now JPA. Also, we use OpenJPA quite intensively. Thus, I woudn't say that it's not mature. It's fine However I would suggest to use Hibernate, namely, JPA wrappers around Hibernate.

Reason? 1) JPA is very, very similar to Hibernate 2) Many job positions has Hibernate requirement. It's better to lean to mainstream products...basically