Hibernate version:
3.2.0.cr4
We have two problems with our cache configuration.
The first is, that I declared a collection in package.MainClass as non mutable:
Code:
<bag name="otherClasses" table = "a_table" lazy="true" order-by="pos" mutable="false" >
<key column="at_id"/>
<many-to-many class="package.OtherClass" column = "oc_id" not-found="ignore" />
</bag>
And configured cache like this:
Code:
<collection-cache collection="package.MainClass.otherClasses" usage="read-only" />
and hibernate says:
WARN : read-only cache configured for mutable class: package.MainClass.otherClasses.
MainClass and OtherClass are also non mutable
The second is, that when the cache has still stored the query but the objects where allready removed from the cache, hibernate fetches the objects by using a seperate select for each object which totally destroys performance. In fact, some pages load faster without any caching at all than when queries are stored but the objects are not. Is there a way to tell hibernate to repeat the entire query if one of the objects in the query result isn't found in the cache anymore?