Hi,
I'm trying to use SetFetchMode to construct a query with two joins, which will bring out parent.parent in a self-referencing entity:
Code:
class Organization
{
private Organization _parent;
...
}
parent property is mapped with many-to-one with cascade="none", and class has lazy=true.
I tried the following code, but it didn't work:
Code:
ICriteria c = session.CreateCriteria(typeof(Organization))
.Add(new EqExpression("Id", 4))
.SetFetchMode("Parent", FetchMode.Join)
.SetFetchMode("Parent.Parent", FetchMode.Join);
The above code can only bring out one join, it seems Parent.Parent does not work.
Any ideas?
Thanks