First off, I'm using NHibernate 1.2.0 and MSSQL with a schema that cannot be changed.
I have a class called RoleAssignment, who's key is a composite consisting of a User object and a Role object. This maps to a shared primary key in the database.
The RoleAssignment class has a list of CompositeConstraint objects. That class has a Guid primary key, but I reference the rows by LoginId (user's PK) and RoleId (role's PK)
I'm not exactly sure how to map this. My bag looks like this:
Code:
<bag name="constraints" access="NHibernate.Generics.GenericAccessor, NHibernate.Generics" cascade="all-delete-orphan">
<key>
<column name="RoleId"/>
<column name="LoginId"/>
</key>
<one-to-many class="CompositeConstraint"/>
</bag>
but I'm not sure how I specify that the RoleId and LoginId columns come from the classes that make up the composite key of this class.
Any help would be greatly appreciated.