marco-p wrote:
Hi all,
I have a cache issue with Hibernate 3.0.5. I've configured a read-write cache on an object that it's externally modified. I know that's a bad idea, 'cause it may produce ObjectNotFoundException if the object is loaded but deleted from db.
What I want to do is to tune the cache usage without disabling it (the table is accessed about 3 times a sec, so it's really important).
The table is updated every hour by a batch process. I think I can manually evict cache for the table when processing ends, but it's still not sure.
I wonder if there's a way to make Hibernate retry the query on a ObjectNotFoundException after evicting the cache.
All suggestions on this argument are welcome.
TIA
Maybe you could set the object in cache to expire every hour or so since the table is updated every hour. So now you will always have the newest object since hibernate will query the database if the object is not found in the cache anyways. Or am I missing something.