openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henno Vermeulen <>
Subject RE: FetchGroup and EhCache Datacache
Date Tue, 04 Nov 2014 09:04:08 GMT
Same here!

For exactly this reason we created our own cache that takes the fetch plan as a parameter.
We implemented it by using ehache with the entity class and id as the key and an instance
of our own class "MultiFetchPlanObjectHolder" as the value. This can simply hold a version
of the entity for different fetch plans. To identify possible fetch plans we introduced a
FetchPlan class which wraps the fetch group strings and has a propery equals + hashcode. (I
guess it is also possible to use the FetchPlan as part of the cache key, but this makes clearing
the cache for a single entity a bit harder.)

To prevent subtle errors, a request for a shallowly fetched entity never returns a more eagerly
fetched version.

Henno Vermeulen

-----Oorspronkelijk bericht-----
Van: Gerald Barker [] 
Verzonden: maandag 3 november 2014 23:17
Onderwerp: Re: FetchGroup and EhCache Datacache

Thanks, I don't absolutely need the cache because the throughput rates are not that good.
I kind of expected this, but hoped it would work. 


----- Original Message -----

From: "David Minor-5 [via OpenJPA]" <>
To: "Gerald Barker" <>
Sent: Monday, November 3, 2014 5:12:35 PM
Subject: Re: FetchGroup and EhCache Datacache 

I reported something similar 5 years ago: 

I've long since abandoned the data cache, and just cache things myself after retrieval. 

From: Gerald Barker < [hidden email] >
Sent: Monday, November 03, 2014 1:43 PM
To: [hidden email]
Subject: FetchGroup and EhCache Datacache 

If I retrieve an object that gets cached (method is Cacheable) according to fields in a fetch
group in a query and then do another query for the same object, but with a different fetch
group and fields (more eagerly loaded
fields) then the second query is resolved in the cache with the eagerly fetched fields from
the first query, but not the second. 

Is this the expected behavior (it is not the desired behavior). 

View this message in context:
Sent from the OpenJPA Users mailing list archive at 

David Minor 

If you reply to this email, your message will be added to the discussion below:
To unsubscribe from FetchGroup and EhCache Datacache, click here . 

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message