Is it possible to disable the Session-level cache, and just rely on the SessionFactory-level cache (JCS)?
I am trying to setup Hibernate in a configuration where multiple Sessions can read from the same cache. This is obviously not possible with the Session-level cache, since it is not shared between Sessions. However it is possible with the JCS cache, since it is used by the SessionFactory.
I can accomplish this by simply creating a new Session every time I access Hibernate objects, thusly never allowing a given Session to respond to my queries with Session-level cache data. But I am hoping to avoid doing this by simply disabling the Session-level cache. I imagine there is also a good bit of overhead involved in creating so many Sessions.
There doesn't appear to be a method on the Session interface to disable its cache. If there were a method Session.evict(Class), I could probably get by, but there is only Session.evict(Object).
Any thoughts, or perhaps alternate approaches?
Thanks,
Keith
|