No. I know that load can (and must) hit the cache when needed. What I'm saying is that when I make an LOAD and the object on cache was modified, then the object must be retrieved again from database and refresh the cache. I think that hibernate don't have to UPDATE this object without an explicit instruction to do this, like session.update().
Session.refresh() can help, if my client application have access to persistence level. This is not the case. I have one façade level taking care of persistence. To use refresh, I need to know if the object was modified before refresh it. If the object wasn't modified, then cache must be used.
The scenario is: the user can make modifications direct on objects previously loaded (most of then are in collections, actually) After make this modifications he can save or not. If choose not save, I have to reload the previous state of these objects.
_________________ -
Marcos Vinicius Dufloth
Cyber, Ltda
Erechim - RS - Brasil
|