Sorry I do not understand. This does not work too:
IQuery query = NHibernateHelper.GetCurrentSession()
.CreateQuery("from Square as s where s not in (select
s from Square as s left join s.Items as i where i.ItemId = :ItemId )
order by :order")
.SetParameter("ItemId", ItemId)
.SetString("order", "SquareId asc")
.SetFirstResult((int)start_index)
.SetMaxResults((int)number_of_requested_rows);
return query.List<Square>();
C
On Jun 23, 3:01 pm, Fabio Maulo <[email protected]> wrote:
> Yes.
> A parameter is a value and not a string injection.
>
> 2009/6/23 csetzkorn <[email protected]>
>
>
>
>
>
>
>
> > I have decided to get the HQL working. Any ideas why this:
>
> > IQuery query = NHibernateHelper.GetCurrentSession()
> > .CreateQuery("from Square as s where s not in (select
> > s from Square as s left join s.Items as i where i.ItemId = :ItemId )
> > order by :order")
> > .SetParameter("ItemId", ItemId)
> > .SetParameter("order", "SquareId asc")
> > .SetFirstResult((int)start_index)
> > .SetMaxResults((int)number_of_requested_rows);
>
> > return query.List<Square>();
>
> > does not work (tried .SetString("order", "SquareId asc") as well) but
> > this does:
>
> > IQuery query = NHibernateHelper.GetCurrentSession()
> > .CreateQuery("from Square as s where s not in (select
> > s from Square as s left join s.Items as i where i.ItemId = :ItemId )
> > order by SquareId asc")
> > .SetParameter("ItemId", ItemId)
> > .SetFirstResult((int)start_index)
> > .SetMaxResults((int)number_of_requested_rows);
>
> > Thanks.
>
> > C
>
> > On Jun 23, 9:52 am, Tuna Toksoz <[email protected]> wrote:
> > > You can do this with Criteria+DetachedCriteria...
>
> > > Tuna Toksöz
> > > Eternal sunshine of the open source mind.
>
> >http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitt...
>
> > > On Tue, Jun 23, 2009 at 11:50 AM, csetzkorn <[email protected]>
> > wrote:
>
> > > > Is this a good solution? Would prefer Criteria API solution though.-
> > Hide quoted text -
>
> > > - Show quoted text -
>
> --
> Fabio Maulo- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---