Can someone tell me what is wrong with my second-level cache configuration.
I have a class called Cat. The class has a collection called kittens. Everything is ok when I don't use the second-level cache.
But when I enable it (I'm using OsCache) the kittens collection always contains the same kittens. Even if the Cat is not the same.
Looking at the debug statements I see that the key for the collection is always kittens. Does this mean that there is only one kittens collection in the whole cache?
Code:
net.sf.hibernate.cache.QueryCache: checking cached query results in region: net.sf.hibernate.cache.QueryCache
com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache: get called (key=net.sf.hibernate.cache.QueryKey@ee3bb1d)
com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache: get called (key=kittens)
com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache: persistRetrieve called (key=kittens)
com.opensymphony.oscache.base.Cache: No cache entry exists for key='kittens', creating
And how is the key determined? Should it not be the hashcode of the collection (kittens) object? Not the name of the instance variable.