criteria (and linq for that matter) work this way. if you want only to query 
Main without part use HQL instead.

var part = session.Load<Part>(partid);
var main = session
                    .CreateQuery("from Main where FirstPart = :part")
                    .SetParameter("part", part)
                    .SetMaxResults(1)
                    .UniqueResult<Main>();

also note, i'm using load instead of get for the part. This will reduce the 
number of remote calls by issuing a single query for Main. Not 2 queries: 1 
for part and 1 for main.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to