I can apply a filter on products but how do I do that on
product.LocalizedProducts? Is that even possible in code? What I have is a
collection of products.

var hql = "select distinct p from Product p left join fetch
p.LocalizedProducts lp where lp.CultureInfoName = :pSomeCulture";

using (var session = sessionManager.OpenSession())
{
  var query = session.CreateQuery(hql);
  query.SetParameter("pSomeCulture", "sv-SE");
  products = query.List<Domain.Product>();
}


On Sun, Sep 6, 2009 at 3:47 PM, Fabio Maulo <[email protected]> wrote:

> You can do something similar withfrom Product
> and activating a Filter on collection
>
> 2009/9/6 Fabio Maulo <[email protected]>
>
> select distinct p from Product p left join fetch p.LocalizedProducts lp
>> where lp.CultureInfoName = :pSomeCulture
>>
>> 2009/9/6 Martin Nilsson <[email protected]>
>>
>> My domain model
>>>
>>> class Product
>>>   prop Title : string
>>>   prop LocalizedProducts : IList(of LocalizedProduct)
>>>
>>> class LocalizedProduct
>>>   prop CultureInfoName : string
>>>   prop Title : string
>>>
>>> Can anyone help me to create a query that selects the products and the
>>> localized product (if exists).
>>>
>>> So if I have this data:
>>>
>>> Product table
>>> id    Title
>>> 1     Car
>>> 2     Truck
>>>
>>> LocalizedProduct table
>>> id    Title   CultureInfoName Product_id
>>> 14    Bil     sv-SE           1
>>> 15    Auto    de-DE           1
>>>
>>>
>>> Then I should have these instances (note that "de-DE" is not loaded):
>>>
>>> Car
>>>   Id : 1
>>>   Title : Car
>>>   LocalizedProducts : { LocalizedProd { Id : 14, Title : Bil } }
>>>
>>> Truck
>>>   Id : 2
>>>   Title : Truck
>>>   LocalizedProducts : {}
>>>
>>> Any help is appreciated!
>>>
>>>
>>>
>>
>>
>> --
>> Fabio Maulo
>>
>
>
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to