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. Regards, Henno Vermeulen -----Oorspronkelijk bericht----- Van: Gerald Barker [mailto:gerald_bar...@psfc.coop] Verzonden: maandag 3 november 2014 23:17 Aan: users@openjpa.apache.org 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. Gerald ----- Original Message ----- From: "David Minor-5 [via OpenJPA]" <ml-node+s208410n7587349...@n2.nabble.com> To: "Gerald Barker" <gerald_bar...@psfc.coop> Sent: Monday, November 3, 2014 5:12:35 PM Subject: Re: FetchGroup and EhCache Datacache I reported something similar 5 years ago: https://issues.apache.org/jira/browse/OPENJPA-1280 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: http://openjpa.208410.n2.nabble.com/FetchGroup-and-EhCache-Datacache-tp7587348.html Sent from the OpenJPA Users mailing list archive at Nabble.com. -- _____________ David Minor If you reply to this email, your message will be added to the discussion below: http://openjpa.208410.n2.nabble.com/FetchGroup-and-EhCache-Datacache-tp7587348p7587349.html To unsubscribe from FetchGroup and EhCache Datacache, click here . NAML -- View this message in context: http://openjpa.208410.n2.nabble.com/FetchGroup-and-EhCache-Datacache-tp7587348p7587350.html Sent from the OpenJPA Users mailing list archive at Nabble.com.