DetachedCriteria detac=DetachedCriteria.For<Test2>("TAR");
                detac.Add(Restrictions.EqProperty("TAR.TestId","T.Id"))

 
.Add(Restrictions.EqProperty("TAR.datetime",Projections.SqlProjection("getdate()-1",

                new []{"Ddate"},

                new []{NHibernateUtil.GuessType(typeof(DateTime))})));

                var crit=session.CreateCriteria<Test>("T");
                crit.AddOrder(Order.Desc(Projections.SubQuery(detac)));


should do the job.


Tuna Toksöz
Eternal sunshine of the open source mind.

http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike




On Sun, Jun 21, 2009 at 3:11 PM, Smsgo <[email protected]> wrote:

>
> Hi Tuna.
>
> > I can help you to convert this into Criteria but not sure how it can be
> done
> > in hql.
>
> Criteria is even better then HQL. I'm looking forwarding to your
> answer!
> >
>

--~--~---------~--~----~------------~-------~--~----~
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