Gauthier's example will work.

On Tue, Sep 9, 2008 at 5:44 PM, goodwill <[EMAIL PROTECTED]> wrote:

>
> Hmm... seems all have to be done in HQL level though? I just lazy on
> that and want to see if I could simply use FindAll to do it. Example
> would be great :)
>
> On Sep 8, 5:11 am, "Colin Ramsay" <[EMAIL PROTECTED]> wrote:
> > I've had mixed results with this, I think there must be a specify way of
> > setting up your mappings to enable this.
> >
> > On Sun, Sep 7, 2008 at 3:35 PM, Tuna Toksöz <[EMAIL PROTECTED]> wrote:
> > > I think this is possible with Criteria, too.
> >
> > > On Sun, Sep 7, 2008 at 5:31 PM, Ron Grabowski <[EMAIL PROTECTED]
> >wrote:
> >
> > >> Thanks for giving that example. One of my pet-peeves with AR/NH is
> that
> > >> the criterion stuff works great for the simple cases when you're
> querying
> > >> against properties on the object itself but I often (read: almost
> always)
> > >> need to look at properties on sub-objects too. I always end up just
> writing
> > >> a full fledged HQL query. I've always wish that this would just work:
> >
> > >> class Person
> > >> {
> > >>  public Department { get; set; }
> > >> }
> > >> class Department
> > >> {
> > >>  public Name { get; set; }
> > >> }
> >
> > >> // find all the people who work in the Accounting department
> > >> Person.FindAllByProperty("Deptartment.Name", "Accounting");
> >
> > >> ----- Original Message ----
> > >> From: Gauthier Segay <[EMAIL PROTECTED]>
> > >> To: Castle Project Users <[email protected]>
> > >> Sent: Sunday, September 7, 2008 9:41:25 AM
> > >> Subject: Re: AR/NH: How to sort by a column in a related table?
> >
> > >> You must add alias to the joined table:
> >
> > >> class Order{Customer Customer {get;}}
> > >> class Customer{string Name {get;}}
> >
> > >> orderCriteria.AddAlias("Customer","c").AddOrder("c.Name")
> >
> > >> On 7 sep, 14:06, goodwill <[EMAIL PROTECTED]> wrote:
> > >> > As title, like if I want to sort staff records by department name
> with
> > >> > certain staffs joining after a date.
> >
> > >> > If I write Order.Asc("Dept.Name") it just won't work.
> >
> > > --
> > > Tuna Toksöz
> >
> > > Typos included to enhance the readers attention!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to