Subselect fetching is not used for collections if their entity owners are initialized in a batch

Description

An entity class is batch enabled and is using SUBSELECT fetch.

When loading a set of entities and their associations using ID based proxies created with em.getReference(...), rather than using subselect each assocation is loaded with an individual query like the below:

Attachments

1

Activity

Show:

Former user June 2, 2016 at 8:54 PM

Fixed in master, 5.1, and 5.0 branches.

Former user May 3, 2016 at 6:46 AM

I've pushed test cases and the fix for 5.1 to my fork: https://github.com/gbadner/hibernate-core/tree/HHH-10679-5.1

Former user April 11, 2016 at 8:48 PM

The attachment is not a fix but can be run against Hibernate 5.1.0 or 5.0.9 to create a testcase. The test added will not fail with an error. I enabled logging to see the incorrect queries (i.e. not using subselect).

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created April 11, 2016 at 8:45 PM
Updated June 30, 2016 at 4:22 PM
Resolved June 2, 2016 at 8:54 PM