In my case, after hitting this bug, we ended up reworking the db, combining the related tables into one table to eliminate the join-luckily that was an option on that project. I don't know of a workaround for this bug that would allow you to leave your tables and data as they are and map them using the join, sorry.
Good luck! On Wed, Feb 23, 2011 at 7:10 PM, hoghweed <[email protected]> wrote: > Yes..you understood well what I said, sorry for my english, and yes > the bug is mine! > You have no idea how bypass or workaround the issue? > > On 23 Feb, 17:14, Anne Epstein <[email protected]> wrote: >> If I'm reading this right, looks like an example of the following >> bug:http://216.121.112.228/browse/NH-1747which is still open. Judging by >> the lack of votes on that bug, it seems that there's not a huge number >> of people that hit this particular bug-and so not much pressure to get >> it fixed quickly. >> >> >> >> >> >> >> >> On Wed, Feb 23, 2011 at 8:41 AM, hoghweed <[email protected]> wrote: >> > Hi guys >> > I have a model of that type >> >> > abstract class BaseEntity >> > { >> > Guid Id >> > } >> >> > class EntityA : BaseEntity >> > { >> > ..other properties.. >> > IList<EntityB> BEntities {get; set;} >> > } >> >> > class EntityB : BaseEntity >> > { >> > ..other properties.. >> > EntityA Owner {get, set;} >> > } >> >> > mapped as follow: >> >> > <class name="BaseEntity" abstract="true" table="TBL_BaseEntity" >> > dynamic-insert="true" dynamic-update="true" lazy="true" > >> > <id name="Id" >> > column="ID_ENTiTY" >> > type="guid" >> > unsaved-value="00000000-0000-0000-0000-000000000000"> >> > <generator class="guid.comb" /> >> > </id> >> >> > <discriminator column="EtityType" type="string" force="true" /> >> > </class> >> >> > <subclass name="EntityA" >> > extends="BaseEntity" >> > discriminator-value="A" >> > dynamic-insert="true" >> > dynamic-update="true" >> > lazy="true"> >> >> > <join table="TBL_ENTITYA"> >> > <key column="ID_ENTITYA" /> >> >> > ...other mapped properties... >> >> > <bag name="BEntities" cascade="save-update" >> > lazy="true" inverse="true" fetch="select" outer-join="true" > >> > <key column="ID_ENTITYA" /> >> > <one-to-many class="EntityB"/> >> > </bag> >> > </join> >> > </subclass> >> >> > <subclass name="EntityB" >> > extends="BaseEntity" >> > discriminator-value="B" >> > dynamic-insert="true" >> > dynamic-update="true" >> > lazy="true"> >> >> > <join table="TBL_ENTITYB"> >> > <key column="ID_ENTITYB" /> >> >> > ...other mapped properties... >> >> > <many-to-one name="Owner" not-null="true" >> > lazy="proxy" fetch="select" column="ID_ENTITYA" /> >> > </join> >> > </subclass> >> >> > now the issue is when I try to insert and cascade a new EntityA with a >> > collection of EntityB correctly initialized (in terms of the bidirectional >> > association) everything works, >> > but when I try to read the EntityA.BEntities collection I got an exception >> > which states that NH could execute the query. >> > After whatching the issue with NHProf I saw that the query produced is >> > incorrect because NH append the column ID_ENTITYA to base table (which >> > clearly not has that column) and not to the >> > destination joined subclass table. >> > Anyone can help me about this prblem? >> > How can I avoid that behavior? >> > It's possible to do that in NH? >> >> > Thanks in advance. >> >> > -- >> > 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. > > -- 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.
