NHibernate Joining on non-mapped property
I have two classes SystemInvitation and User. User has a property called Email and SystemInvitation has a property called InviteesEmailAddress. There is no relationship in the domain between these properties.
Is it possible using the Criteria API to produce a query like:
select si.InviteesEmailAddress , si.Identifier , case when u.id is nul开发者_JAVA百科l then 0 else 1 end as UserExists from SystemInvitation si left outer join [User] u on u.Email = si.InviteesEmailAddress
?
Thanks!
You should map the InviteesEmailAddress column in the mapping for SystemInvitation using something like this:
<many-to-one name="InviteesEmailAddress" fetch="join" class="User"
column="Email" cascade="none" not-found="ignore" />
精彩评论