querycaching should be disallowed/errored for queries that fetch join collections AND filter the elements

Description

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.

Case #00010552

Environment

None

Activity

Show:
Emond Papegaaij
July 22, 2014, 6:28 AM
Edited

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?

Martin L.
May 16, 2017, 9:12 AM

After 11 years (!!!) this issue is still present and caused a serious error in our released application. Please fix it.

Eric Fabian Martinez Rojas
October 5, 2018, 5:55 PM

12 years and counting

Assignee

Unassigned

Reporter

Max Rydahl Andersen

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure