Have you mapped Item.Group? If so, then a simple
session.QueryOver<Item>().Where(x => x.Group == null)
should do the trick. If you haven't [which I suspect from the lack of
"inverse" on the list], then NHibernate has no way of knowing how to
formulate the question to the DB - you might want to consider using a
bidirectional mapping
/Pete
From: [email protected] [mailto:[email protected]] On
Behalf Of kor
Sent: 21 May 2013 10:14
To: [email protected]
Subject: [nhusers] query to select orphans item
hi, i have a "parent" entity that reference a list of items
<class name=Group>
<list name="Items" cascade="none">
<key column="Group_Id" foreign-key="fk_ItemToGroupId"/>
<index column="Item_Index"/>
<one-to-many class="Item"/>
</list>
</class>
<class name=Item>
</class>
i need to do a query (it's better if it's not hql but with queryover,
query, etc) to select all the items not associated with a group.
the generated raw sql query that i want it's something similar to
select *
from Item i
where i.Group_Id is null
thanks
--
You received this message because you are subscribed to the Google
Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.