Hi,
The  syntax for Fetch Join does not allow range variable - as defined in JPA
Spec:

Left Join BNF::
    *LEFT [OUTER] JOIN join_association_path_expression* *[AS]* *
identification_variable*

Fetch Join BNF:
    *fetch_join ::= [ LEFT [OUTER] | INNER ] JOIN FETCH *  *
join_association_path_expression*

Due to this syntax, the fetch join can only be done at one level.
 If you have 2 relations in EntityA, say x and y,   you can join fetch both
x and y as:
    FROM EntityA a LFET JOIN FETCH a.x LEFT JOIN FETCH a.y

This limitation is set in the JPQL syntax.

You could set the grandChildren relation fetchType EAGER so that when
children is fetched the EAGER relation gets loaded as well.

Catalina
On Thu, Feb 5, 2009 at 2:42 PM, mjdenham <[email protected]> wrote:

>
> This is how I would do it in Hibernate but I am new to JPQL and can't work
> out the equivalent syntax:
>   from Parent as parent
>       left join fetch parent.children child
>       left join fetch child.grandChildren
>
> Does anybody know how?  Thanks in advance.
> Martin
> --
> View this message in context:
> http://n2.nabble.com/left-join-fetch-on-Parents%2C-Children%2C-and-GrandChildren-tp2274260p2277843.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>

Reply via email to