Luke:
Many thanks, you were correct my bag definition was missing a "column"
attribute. For anybody searching this forum it should be (e.g.)
<bag name="Groups" table="UserGroup" inverse="true"
cascade="delete" optimistic-lock="false" >
<key column="UserId" />
<many-to-many class="Group" column="GroupId" /> <== i.e. you
need the column of the "other side" of the link table here
</bag>
Fabio:
You are correct. I have a User, Task and Group business classes mapped
to 3 tables and 2 link tables for the many-to-many. Each business
class has a mapping join to the same Audit table on the same column
(EntityID). As the key of each class is a Guid, I know its unique so
they can all share the same EntityID column without risk of data
conflict. I know you prefer HiLo, in which case this wouldn't work as
the data from the different tables would collide.
When NHibernate loads a class, it does an inner join with the Audit
table, an update of the data (assuming I update the audit data)
updates both tables, an insert adds to both tables and a delete
deletes from both tables.
I did remove the optional from the mapping file though.
So, hopefully this is what you meant and, as far as I can tell, it
works as I would expect. I hope this is what you need.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---