session.CreateCriteria(typeof(MyParentTable))
.CreateAlias("MyChildTable", "children")
.Add(Expression.Eq("children.IsMain", 1)).List()

John Davidson

On Wed, Aug 18, 2010 at 2:12 PM, Mike <[email protected]> wrote:

> Can you show an example of how to create an alias on a subset of
> MyChildTable?  That's what I'm really after.
>
> On Aug 18, 12:42 pm, John Davidson <[email protected]> wrote:
> > Then a detached criteria or an alias for MyChildTable in a criteria query
> > would work
> >
> > John Davidson
> >
> >
> >
> > On Wed, Aug 18, 2010 at 12:28 PM, Mike <[email protected]> wrote:
> > > Sorry, forgot to mention that.
> >
> > > Parent can have many children.  The mapping is a one to many, is
> > > completed, and works.  I was trying to optimize a few of my queries.
> >
> > > On Aug 18, 11:09 am, John Davidson <[email protected]> wrote:
> > > > What are your mappings for MyParentTable and MyChildTable? Have you
> > > mapped
> > > > an association in either or both of them?
> >
> > > > John Davidson
> >
> > > > On Wed, Aug 18, 2010 at 11:42 AM, Mike <[email protected]> wrote:
> > > > > Hello,
> > > > > I am trying to emulate the following SQL statement in Criteria API:
> >
> > > > > SELECT ...
> > > > > FROM MyParentTable parent
> > > > >    INNER JOIN MyChildTable child ON (child.ParentID = parent.ID AND
> > > > > child.IsMain = 1)
> >
> > > > > Is this something I would want to used DetachedCriteria for, or is
> > > > > there a more direct way?
> >
> > > > > Thanks!
> >
> > > > > --
> > > > > 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]<nhusers%[email protected]>
> <nhusers%[email protected]<nhusers%[email protected]>>
> > > <nhusers%[email protected]<nhusers%[email protected]>
> <nhusers%252bunsubscr...@googlegroup s.com>>
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/nhusers?hl=en.
> >
> > > --
> > > 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]<nhusers%[email protected]>
> <nhusers%[email protected]<nhusers%[email protected]>>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/nhusers?hl=en.
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
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