Say I have three entities, Owner, Cat, Kitten 

  | @Entity
  | public class Owner {
  |     private Integer ownerId;
  |     private Set<Cat> cats = new HashSet<Cat>(0);
  |     .
  |     .
  |     .
  | }
  | 
  | @Entity
  | public class Cat {
  |     private Integer catId;
  |     private Set<Kitten> kittens = new HashSet<Kitten>(0);
  |     .
  |     .
  |     .
  | }
  | 
  | @Entity
  | public class Kitten {
  |     private Integer kittenId;
  |     .
  |     .
  |     .
  | }
  | 

I want to be able to run one query that will join fetch all owners, cats and 
kittens 

If I wanted to get all cats for all owners I could simply make the query 


  | select o from Owner o join fetch o.cats
  | 

I was trying to get the kittens at the same time with a query like this: 


  | select o from Owner o join fetch o.cats join fetch o.cats.kittens
  | 
but that doesn't work. 

What would be the proper syntax to go multiple levels deep in a join fetch? 

Thanks

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138596#4138596

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138596
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to