Hi,
you can modify the caching mechanism of a session by calling session.setCacheMode(...).
Therefore it is possible to finetune caching behavior on a per-query level according to your needs. And the CacheMode.REFRESH does what it is supposed to do - refreshing the cache.
For example if you know when another application modifies the database (most of time you dont know for sure) you could switch to caching mode REFRESH, issue a query that you know will update the cache with altered data and switch caching mode back to NORMAL.... (of course, this must be done very carefully but might help to improve performance in some situations).
max
|