In memory it fail but in this case by "x.Group.Code" NH means: where group
!= null (in practice filtered by the JOIN through IDs in the SQL).... IIRC
all discussion around NH-2583.
Is that right Herald ?

On Thu, Apr 28, 2011 at 8:03 AM, José F. Romaniello
<[email protected]>wrote:

> Just my curiosity Harald, Do you know how is fixed? because this query will
> fail in memory when Group is null:
>
> session.Query<Product>().Where(x => x.Code = "123" || x.Group.Code =
> "123");
>
> I think a good linq query to achieve the mentioned result; will be
> something like:
> session.Query<Product>().Where(x => x.Code = "123" || x.Group == null ||
> x.Group.Code = "123");
>
>
> OTOH; i implemented ?? the first time, do you know what is the issue? maybe
> i can help
>
> 2011/4/28 Harald M. <[email protected]>
>
> This is bug NH-2583, on which we are currently working. The newest NH
>> from the repository has been fixed by checkins by Patrick, but there
>> are still similar problems (e.g. with the ?? operator).
>> Regards
>> Harald
>>
>> On 27 Apr., 19:03, smalldave <[email protected]> wrote:
>> > Hi,
>> >
>> > I have
>> >
>> >     class ProductGroup
>> >     {
>> >         public string Code{ get; set;}
>> >     }
>> >
>> >     class Product
>> >     {
>> >         public string Code { get; set; }
>> >
>> >         public ProductGroup Group { get; set; }
>> >     }
>> >
>> > I map Product using (not all products belong to product group)
>> >
>> >     class ProductMapping : ClassMap<Product>
>> >     {
>> >         void ProductMapping()
>> >         {
>> >             References(x => x.Group).Nullable.NotFound.Ignore;
>> >         }
>> >     }
>> >
>> > Now I'm give a code that could be for either the product or the
>> > product group. The product and product group codes are mutually
>> > exclusive so I query as follows,
>> >
>> > session.Query<Product>().Where(x => x.Code = "123" || x.Group.Code =
>> > "123");
>> >
>> > This results in an inner join (or the non-ansi 92 equivalient). As
>> > such a product that doesn't belong to a product group but has code
>> > "123" will not be returned in the query.
>> >
>> > Given that I've made it clear that ProductGroup is nullable shouldn't
>> > this join be a left outer? Is there some reason it isn't? Is there a
>> > work around?
>> >
>> > Thanks.
>>
>> --
>> 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.
>>
>>
>  --
> 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.
>



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