I got the following tables:
table X(CODE, FLAGGED, ENTRY_DATE)
table Y(ID, CODE)
table Z(ID, FIRST_NAME, LAST_NAME)
And the following classes:
public class Xclass
{
public virtual string Code { get; set; }
public virtual bool IsFlagged { get; set; }
public virtual DateTime EntryDate { get; set; }
}
public class Yclass
{
public virtual string Id { get; set; }
public virtual string Code { get; set; }
}
public class Zclass
{
public virtual string Id { get; set; }
public virtual string FirstName { get; set; }
public virtual string LastName { get; set; }
}
With the following mappings:
<class name="Xclass">
<id name="Code" />
<property name="IsFlagged" />
<property name="EntryDate" />
</class>
<class name="Yclass">
<id name="Id" />
<property name="Code" />
</class>
<class name="Zclass">
<id name="Id" />
<property name="FirstName" />
<property name="LastName" />
</class>
And I want to do the following simple query:
SELECT X.CODE, Z.FIRST_NAME, Z.LAST_NAME
FROM X, Y, Z
WHERE X.FLAGGED = '1'
AND X.CODE = Y.CODE
AND Y.ID = Z.ID;
I'm new to NHibernate, I read about QueryOver, JoinAlias/JoinQueryOver.
But I can't seem to find anything that points me to the right direction.
Any feedback will be appreciated.