Hi, welcome.
Quote:
on the second call of the query , the query is cached and the auction is returned with a null set for the association UNLESS within a transaction in which case the proxy is invoked .
Of course, you should always work in the scope of a transaction, especially when loading data. The fact that you enable caching or not is meant as a transparent optimization, but it should never affect the semantics, so you should not rely on having a cache to "fix behaviour".
Quote:
I have tried @Cache(usage = CacheConcurrencyStrategy.READ_WRITE,include="all") to include lazy and non lazy, however this doesn't fix the issue
I don't consider this as an issue: sorry but your usage of caches is broken to say the least. You should never access entities out of the scope of a session or entitymanager unless you're doing something very specific and don't expect more data to be loaded - loading from a cache as well.
Quote:
Hibernate3.jar : 3.2.4 sp1
that's very old, many things changed around caching. I 'm not sure that such a new version of ehcache-core works with it: wasn't tested.
Quote:
terracotta-toolkit-1.1-runtime-2.1.0.jar
ehcache-core-2.3.2.jar
ehcache-terracotta-2.3.2.jar
they are not needed if you're using the HashtableCacheProvider
This is the way the hibernate caching works: it's meant to be transparent to the applications. If you want a different behaviour I'd recommend to instantiate a cache directly and control it: that's an application cache, not a session cache. (A session cache needs an open session ;).