openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <>
Subject Re: OpenJPA vs EclipseLink
Date Thu, 03 May 2012 07:51:15 GMT
Hi Andrew!

When I did my first evaluations for a new project 3 years ago. Back then I was checking out
the sources fo EclipseLink, Hibernate and OpenJPA.

EclipseLink just didn't cut it at all. From what I've heard, the Eclipse community now rewrote
a huge part of the code already, but they are imo still quite a few miles away from being
production ready. I have honestly no idea how it could have become the RI for JPA...

Hibernate is much better. It basically works pretty well and is also relatively fast. There
is only one thing which I don't like that much and this is their subclassing approach for
'enhancement'. This has a few nasty side effects and you need to know them.

I finally picked OpenJPA because it was (in my tests) the only JPA provider which was able
to reliably serialize/deserialize entities without loosing state or trashing the database
afterwards. I really need this because we have a real cluster environment and peak 5 mio page
hits/day in our app, so not being able to serialize is a knock out. Of course you need a few
magic properties in your persistence.xml:

<property name="openjpa.DetachState" value="loaded(DetachedStateField=true)"/>
<property name="openjpa.Compatibility" value="IgnoreDetachedStateFieldForProxySerialization=true"/>

The problem with the other JPA providers was the following scenario: 

1.) load from db
2.) change
3.) serialize (store in JSF @ViewScoped and wait for 2nd request)
4.) deserialize 

5.) change in the JSF applyValues phase

6.) merge in a JSF action

if you could change 5 and 6 then the other providers work as well. Too bad that doesn't fit
the JSF workflow!
OpenJPA accomplishes this by _still_ using a StateManager, even if the entity is detached.

In EclipseLink this didn't work at all.

In Hibernate it will work if you do _not_ use any Lazy Loading. Maybe that's the reason why
HIbernate in the default modeeven ignores FetchType.LAZY in the top layer of your entity and
always does eager fetching.


PS: I'm using build-time-enhancement with the openjpa-maven-plugin

----- Original Message -----
> From: Andrew Hastie <>
> To:
> Cc: 
> Sent: Wednesday, May 2, 2012 8:56 PM
> Subject: Re: OpenJPA vs EclipseLink
> For information, OpenJPA it is also embedded with IBM WebSphere.
> On 02/05/12 19:25, José Luis Cetina wrote:
>>  Hi im newbie in OpenJPA i know OpenJPA is an implementation as EclipseLink,
>>  i always used EclipseLink, now im moving from Glassfish to TomEE and i see
>>  openjpa is embeded with TomEE, i read the OpenJPA manual and i like the
>>  innovations in openjpa, but i just want to know the
>>  advantages/disadvantages of openjpa, or a little comparative with openjpa
>>  vs eclipselink or hibernate, and one more thing about how fast is openjpa
>>  vs others.

View raw message