Unable to use Hibernate/JPA "JOIN FETCH a.b.c" when "b" is an association in EAP

Solution Verified - Updated -

Issue

  • A Hibernate/JPA JOIN FETCH query is defined with a join association path expression including multiple associations

    SELECT a FROM EntityA a
    JOIN FETCH a.b b
    JOIN FETCH a.b.c c
    ...
    
  • This query syntax was permitted in early EAP 6.x releases but fails in current EAP 6.4.0 cumulative patch levels with

    ... java.lang.IllegalArgumentException: org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list ...
    

Environment

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

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content