Thanks for your replies, guys. I guess I'll have to upgrade...
On Sep 29, 4:21 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> That will not work on 1.2, only on 2.0
>
> On Mon, Sep 29, 2008 at 5:10 PM, givoni <[EMAIL PROTECTED]> wrote:
>
> > Hi Thomas,
>
> > Thanks for your quick reply.
>
> > The 2nd and 3rd steps are the ones I don't know how to implement :)
>
> > My code looks like this:
> > DetachedCriteria pointsAmount = DetachedCriteria.For(typeof(Points),
> > "pointsAmount")
> > .SetProjection(Projections.Sum("Amount"))
> > .Add(Property.ForName("User.Id").EqProperty("U.Id"))
> > .Add(Expression.Ge("CreateTime", fromDate))
> > .Add(Expression.Le("CreateTime", toDate));
>
> > ICriteria criteria = session.CreateCriteria(typeof(User), "U");
> > criteria.Add(Expression.Eq("U.Activated", true));
> > criteria.Add(Subqueries.Gt(0, pointsAmount));
>
> > How would you add pointsAmount to the order clause?
>
> > Thanks,
> > David
>
> > On Sep 29, 4:02 pm, Thomas Koch <[EMAIL PROTECTED]> wrote:
> > > Hi David - I am not sure that I fully understand your question, but
> > > with NH 2.0 I have done the following:
>
> > > 1) Create the sub-query as a detached query.
> > > 2) Apply the detached query to the "main" criteria, using one of the
> > > static methods in the SubQueries class.
> > > 3) Apply ordering to the main criteria, using the AddOrder method of
> > > the ICriteria interface.
> > > 4) Execute the criteria.
>
> > > Hope this helps, otherwise please give a bit more detail. :-)
>
> > > Cheers,
> > > Thomas
>
> > > On 29 Sep., 15:49, givoni <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
>
> > > > I'm using nhibernate 1.2 and I can't seem to find a way to order by a
> > > > subquery using icriteria.
> > > > Is this possible?
>
> > > > Regards,
> > > > David
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---