openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <>
Subject Re: L1 and L2cache.
Date Mon, 14 Nov 2011 16:36:45 GMT
Hi Ravi,
There are a couple of properties that sort of relate to what you are
requesting.  These are the IgnoreChanges and FlushBeforeQueries properties
as documented here:

Although these properties pertain to your current transactional state (vs
other transactional state), they still may do the trick with forcing the
queries against the database instead of performing an in-memory query.
Specifically, you might want to try setting IgnoreChanges to true (default
is false).

Other than that, I think you have to resort to the programmatic approach of
clearing or refreshing the state of the entities.

Good luck,

On Mon, Nov 14, 2011 at 9:32 AM, Ravi P Palacherla <> wrote:

> EM2's persistence context is not closed and it is executing the queries
> outside transaction.
> The entity still exists in L1 cache and hence the old values are shown. How
> to clear the L1cache ?
> I think there are ways like, entityManager.clear() or refresh() or evict()
> or using new entityManager.
> But all of these are programatic approaches where there is a chance that
> most of the times the data is not changed by EM1 but I still end up
> clearing
> EM2's cache.
> So is there a way I can tell openJPA , when a query is executed, to verify
> if the objects in L1cache are out of sync with L2cache (or when a query
> goes
> to datasource and L1cache values are different from the one's in
> datasource)
> and if they are different then update the L1cache with values of L2cache or
> datasource ?
> --
> View this message in context:
> Sent from the OpenJPA Developers mailing list archive at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message