I'm using NHibernate-2.0.1.GA so I've made some adjustments to your
solution.
Unfortunly SubQuery isn't in my Projections namespace. Has the method
been moved?

        ISession session = NHibernateSessionManager.Instance.GetSession
();

        DetachedCriteria detac=DetachedCriteria.For<Test2>("TAR")
        .Add(Restrictions.EqProperty("TAR.TestId","T.Id"))
        .Add(Restrictions.EqProperty
("TAR.datetime",Projections.SqlProjection("getdate()-1",
            new []{"Ddate"},
            new []{NHibernateUtil.GuessType(typeof(DateTime))}))
        )
       .SetProjection(Projections.Count("TestId"));

        ICriteria crit = session.CreateCriteria(typeof(Test2),"T");
        crit.AddOrder(Order.Desc(Projections.SubQuery(detac)));  <---
--~--~---------~--~----~------------~-------~--~----~
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