Hello,
I seem to misunderstand the purpose of this setting of the CacheMode. Every x minutes, I'm running a query to retrieve objects that may have changed outside of my session/application. These objects have relationships with other objects which are read-only. So basically I load all my read-only objects once with CacheMode.NORMAL and then I retrieve the other objects with CacheMode.GET.
With that, I was expecting the query that I run every x minutes to go fetch my objects without storing them in the session cache (note that I don't use application level cache) since I set the CacheMode to GET. However this is not the case. When I step through the debugger, I see that the TwoPhaseLoad class put my objects in the cache anyway in addUninitializedEntity.
Is there really no way (other than calling evict after the query is run) to keep my modifiable objects out of the session cache? As noted earlier I don't have 2nd level cache and I don't use the query cache.
Thanks for any insight into this issue.
|