I guess i am at a loss for how to do it with DetachedCriteria. How
would I do this with DetachedCriteria
session.CreateCriteria(typeof(StoredValue))
.CreateAlias("Plan", "p")
.AddOrder(Order.Desc("p.ItemsAllowedOut"))
.List<StoredValue>();
I think I got the detached criteria right
DetachedCriteria criteria = DetachedCriteria.For<RentalPlan>("p")
.SetProjection(Projections.Property("ItemsAllowedOut"))
.Add(Restrictions.EqProperty("p.Id", "s.Plan.Id"));
but how do I add the subquery to order by on the main query?
return session.CreateCriteria(typeof(StoredValue), "s")
//TODO: add in the detached criteria to sort
.List<StoredValue>();
Thanks for any help.
On Dec 8, 6:46 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> Same thing, you can order using detached criterira
>
> On Mon, Dec 8, 2008 at 7:42 PM, Jesse <[EMAIL PROTECTED]> wrote:
>
> > Interesting idea Will, that should work for restriction but what about
> > ordering? Any ideas about ordering with an attribute of an association
> > through CreateAlias?
>
> > On Dec 8, 4:03 pm, "Will Shaver" <[EMAIL PROTECTED]> wrote:
> > > If you want to specify it in the where clause without including it in a
> > > join, have NH perform a subquery using DetachedCriteria.
>
> > > On Mon, Dec 8, 2008 at 3:53 PM, Jesse <[EMAIL PROTECTED]> wrote:
>
> > > > Does anybody know how to prevent eager fetching when using CreateAlias
> > > > with the criteria api? I just want to use CreateAlias to specify a
> > > > where clause without bring back the whole association. The association
> > > > is cached so there is no reason whatsoever to bring it back from the
> > > > DB and repopulate.
>
> > > > This may be related to the same issue with Hibernate
> > > >http://opensource.atlassian.com/projects/hibernate/browse/HHH-3538
>
> > > > Thanks for any insight.
> > > > Jesse
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---