I have a question regarding NHibernate in a web environment. The question is basically the same as stated in the following stackoverflow question:
http://stackoverflow.com/questions/822357/how-do-i-add-additional-criteria-to-my-update-command-using-nhibernate In my case I have a one-to-many relation between Employee and Role. I have mapped a Role collection on Employee and marked it as inverse=”true”: <bag name="Roles" cascade="all-delete-orphan" access="field.camelcase- underscore" inverse="true"> <key column="EmployeeId"/> <one-to-many class="Role" /> </bag> The roles of an employee are editable in a browser application. The id of the role is stored in a hidden field on the client and can therefore be “hacked”. An employee is only supposed to update the name of the role. And of course only roles which belong to the logged on employee. However, when Nhibhernate updates a Role it only uses the Id of the role in the where clause: Update Role Set Name = ‘ffff’ where RoleId = 1. Is it possible to instruct NHibernate to also use the EmployeeId when updating the Role: Update Role Set Name = ‘ffff’ where RoleId = 1 and EmployeeId = 2? Same for the delete statement: Delete from Role where RoleId = 1 and EmployeeId = 2. What would be the best solution?
-- 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.
