Weird Behavior of Cache with fetchmode join and scroll-iterator

Description

Hi guys,

i found out a weird behavior with the collectionsCache when I overwrite the Fetchmode in a Criteria-query to JoinMode and use the scroll-iterator. It seems like the query builds every single child as a bag and puts it into the second-level-collection-cache.
It seems not to act like an O/R-Mapper. Such Join-Statements should be grouped or at least not corrupt the cache.
Background: I want to preheat the Secondlevel-cache with just one statement. i get rid of the ripple loading.

example

City.java:

Citizen.java:

the TestCase:

thanks

Environment

org.hibernate.dialect.H2Dialect, In-Memory-DB

Assignee

Unassigned

Reporter

Karolis Kleiza

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Critical
Configure