[hibernate-dev] Multi-level Fetch Joins
Steve Ebersole
steve at hibernate.org
Sat Sep 19 12:01:46 EDT 2015
On Wed, Sep 16, 2015 at 8:38 PM Gail Badner <gbadner at redhat.com> wrote:
> Is the only JPA-compliant way to do a multi-level fetch join to use entity
> graphs?
>
> JPA 2.1 does not support fetch joins using an alias at all. JSR 338,
> 4.4.5.3 Fetch Joins says,
>
> "It is not permitted to specify an identification variable for the objects
> referenced by the right side of the FETCH JOIN clause, and hence references
> to the implicitly fetched entities or elements cannot appear elsewhere in
> the query. "
>
> (I know that HQL supports using an alias for nested fetch joins. [1][2])
>
> Also in JSR 338, 4.4.5.3 Fetch Joins is:
>
> fetch_join ::= [ LEFT [OUTER] | INNER ] JOIN FETCH
> join_association_path_expression
>
> If I understand correctly, the definition of
> join_association_path_expression does not allow for join fetching a nested
> association using a path, as in:
>
> select c from Cat c join fetch c.father join fetch c.father.mother <= not
> supported by JPA or HQL
>
> (There is an open Jira for supporting nested join fetches using HQL:
> HHH-8206. [3])
>
> Is there a JPA 2.0-compliant way to do this (without entity graphs)?
>
> Thanks,
> Gail
>
> [1]
>
> http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/#queryhql-joins
> [2]
>
> https://docs.jboss.org/hibernate/orm/5.0/userGuide/en-US/html_single/#d5e1869
> [3] https://hibernate.atlassian.net/browse/HHH-8206
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
More information about the hibernate-dev
mailing list