Yes it is. I figured it out almost on the second when you replied to
me.

My issue in the end was that the component was part of a many-to-one
entity, and I was confusing making an alias for the component with
making an alias for the many-to-one entity.

Now that I did that, look at that, it works. I hate fridays :)

Thanks though!

-Francois Ward

On Aug 6, 9:39 am, Diego Mijelshon <[email protected]> wrote:
> It's simpler than you think...
>
> var result = this.session.CreateCriteria<Foo>
> .AddOrder(Order.Asc("TheComponent.FirstProperty"))
> .List<Foo>();
>
>     Diego
>
>
>
> On Fri, Aug 6, 2010 at 10:21, Francois Ward <[email protected]> wrote:
> > This is probably a silly question, but I can't find the answer
> > anywhere, so I hope you can forgive me :)
>
> > I'm trying to do something pretty simplistic: a criteria query that
> > sorts on one of the properties of a component. Simple enough, right?
>
> > //pseudo code, so i may make a mistake
> > var result = this.session.CreateCriteria<Foo>
> > .CreateAlias("SomeProperty.MyComponent", "bar")
> > .AddOrder(Order.Asc("bar.FirstProperty"))
> > .List<Foo>();
>
> > Exception: "could not resolve property: FirstProperty of:
> > Foo.SomeProperty
>
> > Well, of course, i'm trying to sort on
> > Foo.SomeProperty.MyComponent.FirstProperty, not
> > Foo.SomeProperty.FirstProperty, thus the alias!
>
> > The component works fine in every other ways, including projections,
> > so I think my mapping is correct, and i can sort on the component if i
> > sort directly on the component (the SQL generated is then an Order By
> > clause with all of its properties, but i only want one).
>
> > Is aliasing the component the wrong way of doing this? I'm sure i'm
> > missing something obvious :)
>
> > Thanks!
>
> > -Francois Ward
>
> > --
> > 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]<nhusers%[email protected] 
> > >
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.

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