I have a class that is mapped to a view. I do this because some of the attributes of the class are denormalized from other tables. When I attempt to delete an instance of my class, I get the following SQL Server error:
View or function 'MooView' is not updatable because the modification affects multiple base tables
Question: Is it possible to change my NHibernate mapping so that the delete is executed against the actual table (Moo) rather than the view (MooView)?
Here's what the relevant portion of my mapping file looks like:
Code:
<class name="Moo" table="MooView">
<property name="BaaName" insert="false" update="false" />
</class>
Note that the class is mapped to a view that spans two tables: Moo and Baa. "BaaName" is a derived value obtained from the Baa table rather than the Moo table, hence it is marked as insert/update = false.
How can I delete an instance of Moo?