Is there no way of doing this using the Criteria api? I am using the
MultiCriteria here, and as far as I know I don't have the possibility to use
HQL there?
On Wed, Oct 29, 2008 at 12:32 PM, Fabio Maulo <[EMAIL PROTECTED]> wrote:
> from Company c join c.Address a where a.City like 'bru%' order by
> c.CompanyGroup.Name
>
> 2008/10/29 Bart Reyserhove <[EMAIL PROTECTED]>
>
>> Yeah I know that is the easy part, what I am trying to do is something
>> along the lines of:
>>
>> DetachedCriteria.For<Company>()
>> .CreateCriteria("Address").Add(Restrictions.Like("City","bru")
>> .CreateCriteria("CompanyGroup","cg").AddOrder(Order.Asc("cg.Name")
>>
>> The problem is of course that CompanyGroup is an association of Company
>> and not of Address.
>>
>>
>> On Wed, Oct 29, 2008 at 4:56 AM, Ayende Rahien <[EMAIL PROTECTED]> wrote:
>>
>>> Something like:
>>> DetachedCriteria.For<Company>()
>>> .CreateCriteria("CompanyGroup", "cg")
>>> .AddOrer(Order.Asc("cg.Name")
>>>
>>>
>>> On Wed, Oct 29, 2008 at 12:21 AM, Bart Reyserhove <
>>> [EMAIL PROTECTED]> wrote:
>>>
>>>> I have an domain object: Company.
>>>> 1) Company has an association with an Address
>>>> 2) Company also has an association with CompanyGroup
>>>>
>>>> I am trying to use the ICriteria stuff to create a query that retrieves
>>>> all Companies where Address.Country = 'Belgium' and I want to order this
>>>> result on the name property of CompanyGroup.
>>>>
>>>> The filter is no problem at all. I can easily find all Belgian
>>>> companies, but sorting them on another association seems really difficult
>>>> at
>>>> first sight.
>>>>
>>>> How can I approach this?
>>>>
>>>> Thanks,
>>>>
>>>> Bart
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
>
> --
> Fabio Maulo
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---