Perhaps with the whole mapping and classes somebody else may help you.

--
Fabio Maulo


El 23/07/2010, a las 13:01, Jim Geurts <[email protected]> escribió:

> Fabio,
>
> Since this is apparently not a bug and is a mapping error according to
> NH-2212, can you show me the light on what I'm doing wrong?
>
> I have a bag defined for a many-to-many list:
> <class name="Author" table="Authors">
>    <id name="Id" column="AuthorId">
>        <generator class="identity" />
>    </id>
>    <property name="Name" />
>    <bag name="Books" table="Author_Book_Map" where="IsDeleted=0"
> fetch="join">
>        <key column="AuthorId" />
>        <many-to-many class="Book" column="BookId"
> where="IsDeleted=0" />
>    </bag>
> </class>
>
> Now, if I return all author objects (using something like
> Session.Query<Author>().List<Author>()), I will get what initially
> appeared to be duplicate Author records: The extra author objects are
> created when an author is mapped to multiple books that vary by
> IsDeleted.  Rather than creating one Author object with an enumerable
> that contains only the books with IsDeleted = 0, it will create two
> author objects.  The first author
> object has a Books enumerable that contains books with IsDeleted = 0.
> The second author object will contain an enumerable of null book
> objects.
>
> I'm thinking part of the problem stems from the map table objects
> linking to rows that do not meet the many-to-many where condition. Is
> this a configuration issue or something else?
>
> Thanks,
>
> Jim
>
> --
> 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.

Reply via email to