Using NHibernate QueryOver
, I want to join two tables using two columns which are not defined in the mapping as a relationship.
E.g. This is not my exact scenario but this can explain that
Tables:
Employee(Id, Name, DepartmentId, SomeCode,Address)
Department (Id, Name, ,Code)
Select
SELECT *
FROM EMPLOYEE E
JOIN DEPARTMENT D
ON D.Code = E.SomeCode
Can someone please tell me how to do this query using NHibernate QueryOver
. Note that "SomeCode" in Employee
and "Code" in Department
are not defined as a relationship. DepartmentId is the foreign key and I can join these using JoinAlias
but I want it in a somewhat different way.