Subselect fetching does not work when MultiIdentifierLoadAccess is used in Hibernate

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7
  • Hibernate
    • 5

Issue

  • Entities are loaded via MultiIdentifierLoadAccess.multiLoad() in one batch via a query using an IN clause.
  • The entities have lazy-fetched OneToMany associations annotated with FetchMode.SUBSELECT.
  • When accessing the associations, they are fetched using one query per parent entity.

Resolution

This issue1 is resolved in This content is not included.EAP 7.1 cumulative patch (CP) 5 and later releases.

Root Cause

This is a known defect (Content from hibernate.atlassian.net is not included.HHH-12740).

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.