Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:2.1.2
I am having this ORA-02292: integrity constraint (PROVIDER.SYS_C0016817) violated - child record found error when I delete record in database using delete() method. I have two tables map to two classes: PublicationEmail (P1) and PublicationEmailNetworksType (P2). P1 have a set of P2. Here are the mapping:
P1:
<class name="PublicationEmail" table="TBL_PUB_EMAIL" dynamic-update="true">
<id column="PK_PUB_EMAIL_ID" name="id" type="integer">
<generator class="sequence">
<param name="sequence">SEQ_PUB_EMAIL_ID</param>
</generator>
</id>
<property column="SUBJECT" name="subject" type="string" />
<set inverse="true" name="pubEmailNetworksTypes" cascade="all">
<key column="FK_PUB_EMAIL_ID" />
<one-to-many class="com.model.PublicationEmailNetworksType" />
</set>
</class>
P2:
<class name="PublicationEmailNetworksType" table="TBL_PUB_EMAIL_NETTYPE">
<id column="PK_PUB_EMAIL_NETTYPE_ID" name="id" type="integer">
<generator class="sequence">
<param name="sequence">SEQ_PUB_EMAIL_NETTYPE_ID</param>
</generator>
</id>
<many-to-one class="com.model.PublicationEmail" name="pubEmail"
cascade="save-update">
<column name="FK_PUB_EMAIL_ID" />
</many-to-one>
<property column="FK_PROVIDER_NETWORKS_TYPE" name="networksType" type="com.model.customtypes.ProviderNetworksTypeUserType"/>
</class>
When I call dao.delete(pubEmail), sometimes it works fine, but sometimes it failed:
Caused by: java.sql.SQLException: ORA-02091: transaction rolled back
ORA-02292: integrity constraint (PROVIDER.SYS_C0016817) violated - child record found
What is wrong? I am using ral old version of Hibernate (2.1.2), is that a problem? I see 3.0 has this:
support cascade delete via ON DELETE CASCADE constraint
Does that matter?
Thanks,
J