Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » How to flush EclipseLink Query cache for a specific query?
How to flush EclipseLink Query cache for a specific query? [message #387933] Tue, 19 May 2009 11:23 Go to next message
Torben Putkonen is currently offline Torben Putkonen
Messages: 34
Registered: July 2009
Member
We are using EclipseLink 1.1.0 query cacheing with JPA interface. Our data
is mostly very static, however once a day the data is refreshed from an
external source. When the refreshing has been done, I would like to
somehow invalidate all the query and entity cache data associated with a
specific query. Is there a way to accomplish this?
Re: How to flush EclipseLink Query cache for a specific query? [message #387935 is a reply to message #387933] Tue, 19 May 2009 13:28 Go to previous messageGo to next message
Torben Putkonen is currently offline Torben Putkonen
Messages: 34
Registered: July 2009
Member
IdentityMapAccessor class seems to offer related methods, but I would
really appreciate an example how to use it with JPA code to invalidate
named query declared in an entity.
Re: How to flush EclipseLink Query cache for a specific query? [message #387948 is a reply to message #387935] Tue, 19 May 2009 19:44 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Would be something like:

((JpaEntityManager)entityManager.getDelegate()).getServerSes sion()
.getIdentityMapAccessor().clearQueryCache("<queries name>");

You can also set an invalidation policy on the named query to have to
invalidate after a certain amount of time, or daily using the hint,
"eclipselink.query-results-cache.expiry"
or,
"eclipselink.query-results-cache.expiry-time-of-day"

---
James
http://www.nabble.com/EclipseLink---Users-f26658.html


James : Wiki : Book : Blog : Twitter
Re: How to flush EclipseLink Query cache for a specific query? [message #388107 is a reply to message #387948] Fri, 22 May 2009 08:08 Go to previous message
Torben Putkonen is currently offline Torben Putkonen
Messages: 34
Registered: July 2009
Member
Thanks!

We were already using expiration after one hour, but once a day we update
the whole database and clear the whole cache just to be sure (even though
I don't think it's really necessary because the database is updated using
EclipseLink).
Previous Topic:getting the active JPA UnitOfWork
Next Topic:Object database db4o EclipseLink integration
Goto Forum:
  


Current Time: Fri Sep 19 09:56:53 GMT 2014

Powered by FUDForum. Page generated in 0.01725 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software