The title of this thread say: "when the relation is represented by a class with additional properties"
Where is the class, and its mapping, representing the many-to-many relation ? On Sat, Jul 24, 2010 at 6:08 PM, Jim Geurts <[email protected]> wrote: > I don't mean to be rude, but you closed the bug. You asked me to post > the issue to the list, which I did previously, multiple times... > without reply. I created unit tests that reproduce this issue, yet > still no reply from anyone. It seems like a common issue that people > are going to run across. I'm just looking for either a description of > how I'm mapping things wrong, or how to properly accomplish this type > of situation... > > Thanks, > > Jim > > > On Jul 23, 6:49 pm, Fabio Maulo <[email protected]> wrote: > > 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]<nhusers%[email protected]> > . > > > For more options, visit this group athttp:// > 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]<nhusers%[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.
