enabling query caching for something like:
"select parent from Parent p inner join fetch p.children as pc where pc.somefield = :field"
will result in the "incomplete" collections to be stored resulting in subsequent lookups in the collection cache to be wrong.
This issue is almost 8 years old now, and still present in the latest version of Hibernate (4.3.6). There is no good work around, except for disabling collection caching entirely. This bug can cause serious errors in applications. provides a good testcase. Perhaps someone can take a look at this? I'm unable to edit the affected versions, but all versions from 3.2 to 4.3 should be added.
Also, this issue talks about the query cache, but enabling or disabling the query cache does not affect the collection caches. The only way to prevent this problem is by disabling collection caching entirely, not per query. Can the title and description be updated to reflect this?
After 11 years (!!!) this issue is still present and caused a serious error in our released application. Please fix it.
12 years and counting