KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have following mapping definitions: <class name="Role" table="Role" optimistic-lock="version" > <id name="Id" type="Int32" unsaved-value="0" > <generator class="native" /> </id> <property name="RoleName" type="String(40)" not-null="true" /> <bag name="UsersInRole" generic="true" lazy="true" cascade="all" table="UserRoles" > <key column="RoleId" /> <many-to-many column="UserId" class="SystemUser, Domain"/> </bag> and <id name="Id" type="Int32" unsaved-value="0" > <generator class="native" /> </id> <property name="UserName" type="String(40)" not-null="true" unique="true" /> This mapping generates mapping table UserRoles, which has two columns - RoleId and UserId. However, I'd like to add extra attributes to that relation - i.e. some enum values defining state of the relation as well as effective start & end dates. Is it possible to do in nhibernate or do I need to add additional class here and change relation m-to-m into 2 relations [user] 1-to-m [user_role] m-to-1 [role] ?
Tags (comma-separated)
Save Edits
Cancel