I have a Staff and e SecuredPage entity and the properties are below
Staff
id Name LastName Level // SecuredPage.RoleId
SecuredPage
id PageId RoleId // Staff.Level
I want to have a collection of SecuredPage in Staff entity, so it s a one-to-many but i couldnt figure it out how to handle with it in mapping.
Staff.hbm.xml
<bag name="SecuredPages" lazy="true" inverse="false" cascade="none">
<key column="RoleId" />
<many-to-many class="RealEstate.Core.Domain.SecuredPage,RealEstate.Core" />
</bag>
with the code above Nhibernate gets all the records from SecuredPage table where
SecuredPage.RoleId = Staff.id
But i want it to be
SecurePage.RoleId = Staff.StaffLevel
I didnt create a Role Entity for some reasons that's why i am directly trying to get secured pages for Staff based on its Level(Role)
I hope i could tell you about my problem. I have checked Nhibernate guide, read all about collections mappings but i couldnt figure it out.
Thanks