em yes this is the reason why I want use the Criteria api ;-). The
question is not how to use the api, it's how to add conditions to a
join? In hql you can do this with the "with" keyword as Fabio
mentioned but there is no equivalent in the criteria api.

On Sep 15, 11:08 pm, Jason Meckley <[email protected]> wrote:
> Criteria is meant to build queries at run-time (dynamically). HQL is
> meant for design-time queries. trying to build an HQL statement at
> runtime is counter intuitive.
>
> var criteria = session.CreateCriteria<Entity>();
> if(....)
> {
>    criteria.Add(....);}
>
> //repeat as necessary
>
> var results = criteria.List<Entity>();
>
> On Sep 15, 4:59 pm, Armin Landscheidt <[email protected]> wrote:
>
> > Is there a way to do this with the Criteria API? In my project I'm
> > building a dynamic query an using HQL at this point is a pain.
>
> > On Sep 13, 3:07 pm, harshil hameed <[email protected]> wrote:
>
> > > can we do same with out HQL,
> > > (//like wise  Criteria.CreateAlias,)
> > > we are not recommend HQL any where in Product.
>
> > > On Mon, Sep 13, 2010 at 5:28 PM, Fabio Maulo <[email protected]> wrote:
> > > > the clause is : "with"
> > > >http://fabiomaulo.blogspot.com/2009/05/nhibernate-210-hql-with-clause...
>
> > > > On Mon, Sep 13, 2010 at 8:23 AM, Armin Landscheidt 
> > > > <[email protected]
> > > > > wrote:
>
> > > >> Hello,
>
> > > >> I have a little performance problem and could resolve it if I could
> > > >> add the restriction in the where clause to the join clause. Actual the
> > > >> generated sql looks like:
>
> > > >> select * from parent p
> > > >> left outer join child c on c.Parent = p.Id
> > > >> where p.Name like '%theName%' or c.Name like '%theName%'
>
> > > >> This is to slow. But if I could generate a statement like
>
> > > >> select * from parent p
> > > >> left outer join child c on c.Parent = p.Id and c.Name like '%theName%'
> > > >> where p.Name like '%theName%'
>
> > > >> it would be much faster.
>
> > > >> Is there a way to realize this?
>
> > > >> Regards Armin
>
> > > >> --
> > > >> 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.
>
> > > > --
> > > > Fabio Maulo
>
> > > >  --
> > > > 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