This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Clear the cache Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Clear the cache" Watch "Clear the cache" New topic
Author

Clear the cache

Padma Priya
Ranch Hand

Joined: Feb 01, 2007
Posts: 113
Hi All,

I am new to the concept of caching.

I am trying to clear the cache using




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

Thank you!
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
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,

emf.getCache().evictAll()


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clear the cache