The hibernate query cache only seems to work for some queries. What are the criteria for which queries are or are not cached?
When I call
query.setCacheable(true);
after a query, sometimes the query gets cached and sometimes it does not.
See the sql below to see a few of the queries that are not being cached.
Hibernate version:
3.0.2
The generated SQL (show_sql=true):
Hibernate: select fieldstrin0_.cobj as cobj__, fieldstrin0_.id as id__, fieldstrin0_.id as id0_, fieldstrin0_.val as val11_0_, fieldstrin0_.cobj as cobj11_0_, fieldstrin0_.meta as meta11_0_ from know.customobjfieldstringsearch fieldstrin0_ where fieldstrin0_.cobj=?
Hibernate: select objtype0_.id as col_0_0_ from know.objtype objtype0_ where objtype0_.visibility in (?) order by objtype0_.capitalizedSingularName
Hibernate: select this_.id as id0_, this_.visibility as visibility28_0_, this_.modStatus as modStatus28_0_, this_.whenCreated as whenCrea4_28_0_, this_.unumCreated as unumCrea5_28_0_, this_.whenModified as whenModi6_28_0_, this_.unumModified as unumModi7_28_0_, this_.capitalizedPluralName as capitali8_28_0_, this_.longDesc as longDesc28_0_, this_.isSuperset as isSuperset28_0_, this_.parent as parent28_0_, this_.capitalizedSingularName as capital12_28_0_ from know.objtype this_ order by this_.capitalizedPluralName asc
Hibernate: select this_.id as id0_, this_.visibility as visibility26_0_, this_.modStatus as modStatus26_0_, this_.whenCreated as whenCrea4_26_0_, this_.unumCreated as unumCrea5_26_0_, this_.whenModified as whenModi6_26_0_, this_.unumModified as unumModi7_26_0_, this_.longDesc as longDesc26_0_, this_.isSuperset as isSuperset26_0_, this_.capitalizedSingularName as capital10_26_0_ from know.listtype this_ order by this_.capitalizedSingularName asc
Hibernate: select this_.id as id0_, this_.listType as listType25_0_, this_.objType as objType25_0_ from know.listtypeallowed this_
|