Reputation: 9389
In a new project I created my class let's say ProductSpecialGroup :
ProductSpecialGroup
- string Name
- IList<Product> Products
In this project I had to create also the mapping for the Product table that already exists and is used by many more project.
Is there any way to tell to nhibernate : don't touch this table, don't update/delete it, just select from it ? Or at least what are the configuration( with cascade I think) that I need to check to be sure that a myProductSpecialgroup.Products.Clear() won't create a disaster ?
Upvotes: 2
Views: 148
Reputation: 64628
Use mutable="false" and check the cascades as proposed by swannee. In addition to that, if it is that critical, consider using a view or consider to grant only read permissions to that table.
Upvotes: 1
Reputation: 3466
If you set "mutable" = false in the table mapping it will treat it as read-only. Also to be sure you can set the cascade from the parent to "none"
Upvotes: 4