2 Replies Latest reply on May 24, 2006 11:42 AM by Martin Söderström

    Nested JOIN FETCH

    Martin Söderström Newbie

      Hi,

      Let's say I have three Entity classes A, B and C and the relations A 1:n B 1:n C. The collections are named A.bs and B.cs. No relation is marked with fetch=EAGER in the @OneToMany annotations.

      With the query

      SELECT DISTINCT a FROM A a JOIN FETCH a.bs WHERE a.id = 1

      I get the Bs eagerly loaded as expected in A.

      Now, is there a way to alter this query to also include the eager loading of the Cs in the B?

      The whole point is to avoid the fetch=EAGER in the @OneToMany annotations.

      Regards