开发者

NHibernate Joining on non-mapped property

开发者 https://www.devze.com 2022-12-13 06:57 出处:网络
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 prope

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" />
0

精彩评论

暂无评论...
验证码 换一张
取 消