File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
REST with Spring (video course)
this week in the
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
I agree. Here's the link:
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