Matrasinator wrote:
there isn't any way that i can optimally retrieve an object and
all the assosiacions?
Lets say we have
class Cat
{
public string Name {get;set;}
public List<Cat> Kittens {get;set;}
public List<Cat> Pals {get;set;}
}
If i'd want to retrieve all of the associations of a cat:
from Cat cat join fetch cat.Kittens, join fetch cat.Pals
This HQL generetes a single select if i'm not mistakeing.
But why do you say it makes a cartesian product?
That's inneficient.
It makes a cartesian product because it will return a row for every combination of Kitten and Pal.
For this case a MultiQuery can be used: see the end of this section:
http://www.hibernate.org/hib_docs/nhibe ... ulti-query