Reputation: 2510
I have an application using Hibernate with ehcache as the 2nd level cache. I have been trying to figure out how I can invalidate a specific object in the cache thereby forcing hibernate to reload it from the database the next time it is referenced.
Is there an easy way to do this?
I've tried several things but so far been unsuccessful. Any suggestions would be appreciated.
Upvotes: 0
Views: 913
Reputation: 7218
You can use:
SessionFactory.getCache().evictEntity(Class entityClass, Serializable identifier)
Upvotes: 2