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:
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 in master, 5.1, and 5.0 branches.