Hello, I am using many-to-many mapping that are working great like this:
Code:
<set name="userRules" lazy="false" table="User_Rules" order-by="RuleId asc">
<key column="UserId"/>
<many-to-many column="RuleId" class="com.org.hibernate.pojos.RuleBean"/>
</set>
The problem is when one of this mappings have an intermediate table "User_Rules" that is not really a table, but a view.
The mapping works good when trying to retrieve elemnts of one table from the other.But when I try to delete an element from on of the tables (user for example), it tries to delete the element from the intermediate table ("User_Rules") as well, and it cant bacause in this case it is a view, and it gives me this error:
Code:
WARN 2009-07-29 15:34:18,312 - SQL Error: 0, SQLState: null
ERROR 2009-07-29 15:34:18,312 - Batch entry 0 delete from User_Rules where UserId=66 was aborted. Call getNextException to see the cause.
WARN 2009-07-29 15:34:18,312 - SQL Error: 0, SQLState: 0A000
ERROR 2009-07-29 15:34:18,312 - ERROR: cannot delete from a view
Is there a way to tell hibernate not to delete elements from the intermediate table?? thanks!!!