Sure...
from Foo foo
left join foo.Bar bar with bar.Data > 0
The "with" clause adds the condition to the join and works regardless of the
type of join or relationship (many-to-one, one-to-many...)
Diego
On Thu, Aug 19, 2010 at 10:27, Mike <[email protected]> wrote:
> Hi Diego,
> Can you show an example? I am not very fluent with HQL. Thanks!
>
> On Aug 18, 4:04 pm, Diego Mijelshon <[email protected]> wrote:
> > HQL supports left joins with the condition in the join. You might want to
> > switch query methods...
> >
> > Diego
> >
> > On Wed, Aug 18, 2010 at 17:13, Francois Ward <[email protected]
> >wrote:
> >
> >
> >
> > > That works for inner joins, but when LEFT joins are involved, it won't
> if i
> > > understand correctly. The condition is in the where clause, not in the
> join,
> > > when you do this. Same result for INNER JOIN, but you'll be missing
> rows
> > > with LEFT OUTER JOIN.
> >
> > > On Wed, Aug 18, 2010 at 2:31 PM, John Davidson <[email protected]
> >wrote:
> >
> > >> 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>>
> > >>> > > <nhusers%[email protected]<nhusers%[email protected]>
> <nhusers%252bunsubscr...@googlegroup s.com>
> > >>> <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]>>
> > >>> <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]>
> <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]>
> <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.