Hello everybody!
I have a n:m relation between two objects with a composite element in between.
When i want to delete the object I get an Exception saying that there are still childentities.
Adding cascade="all" doesn't solve this issue. Can someone see y ??
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="PersistenceLayer.Entity, PersistenceLayer" table="entities">
<id name="Id" column="typeId" type="String">
<generator class="uuid.hex" />
</id>
<property name="Name" column="name" type="string" />
<property name="Description" column="description" type="string" />
<idbag name="ChildEntities" table="entities_attributes" cascade="all">
<collection-id type="String" column="types_attributes_id">
<generator class="uuid.hex" />
</collection-id>
<key column="entityId" />
<composite-element class="PersistenceLayer.CompositeElements.EntityAttribute, PersistenceLayer">
<property name="Value" column="value" />
<many-to-one name="Attribute" column="attributeId" class="PersistenceLayer.Attribute, PersistenceLayer" lazy="false" />
</composite-element>
</idbag>
<bag name="Changes" cascade="all">
<key column="typeId" />
<one-to-many class="PersistenceLayer.History, PersistenceLayer" />
</bag>
</class>
</hibernate-mapping>
Exception:
Code:
Test method TypeServiceTest.CopyTypeTest threw exception: Spring.Data.UncategorizedAdoException: Hibernate operation: could not delete: [PersistenceLayer.Entity#b120088015fc4881991172f7a2fbbe72][SQL: DELETE FROM entities WHERE entityId = ?]; uncategorized DataException for SQL [DELETE FROM entities WHERE entityId = ?]; ErrorCode [<no error code>]; ORA-02292: Verstoß gegen Constraint (DB.FKB029AD7E7D46EB33). Untergeordneter Datensatz gefunden.
---> System.Data.OracleClient.OracleException: ORA-02292: Verstoß gegen Constraint (DB.FKB029AD7E7D46EB33). Untergeordneter Datensatz gefunden.
.