A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
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
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
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-2014