Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Refactoring for Software Design Smells: Managing Technical Debt
this week in the
OO, Patterns, UML and Refactoring
Object Relational Mapping
Clear the cache
Joined: Feb 01, 2007
Jun 21, 2012 12:42:42
I am new to the concept of caching.
I am trying to clear the cache using
((JpaEntityManager) em.getDelegate()).getServerSession().getIdentityMapAccessor().invalidateAll(); ((JpaEntityManager) em.getDelegate()).getServerSession().getIdentityMapAccessor().clearQueryCache();
I do a change in the database and then trying to invoke this. But i see the same onld stale data. Can you please point me to what further steps need to be taken to clear the cache.
Thank you in advance for the help
Joined: Oct 01, 2007
Jun 25, 2012 07:08:28
This should work. You also need to call clear() on your EntityManager or create a new one.
In JPA 2.0 you can also just use,
Blog:Java Persistence Performance
Have you checked out
subject: Clear the cache
JPA Native Query
validations in java script
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015