Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Clear the cache

 
Padma Priya
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic