The inserts work correctly, but on delete it fails. My delete code
first ejb
remove's the B2C (child) table then the individual (parent) bean. The
B2C delete
works fine, but for some reason the Individual bean's ejb remove
causes -
"DELETE statement conflicted with COLUMN REFERENCE constraint
'FK_B2CIndi
vidualCustomers_IndividualCustomers'. The conflict occurred in
database 'Custome
rDB', table 'B2CIndividualCustomers', column 'IndividualCustomerID'."
The database is somehow still seeing that B2C child record, thinking
it's now
orphaned, but the ejb remove of the child record (B2C bean) should
have removed that
B2C row. So why does deleting the parent row (Individual bean) cause
this? It might be
a bug in the driver (Opta 2000) I'm using. The generated SQL code
looks like it's
firing in the correct order, so I'm not sure why this is happening.
My ejb-jar.xml relationship setup is -
<ejb-relation>
<ejb-relation-name>IndividualCustomer-B2CIndividualCustomer</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>
IndividualCustomer-Has-B2CIndividualCustomer
</ejb-relationship-role-name>
<multiplicity>one</multiplicity>
<relationship-role-source>
<ejb-name>IndividualCustomer</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>b2cIndividualCustomer</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>
B2CIndividualCustomer-IsA-IndividualCustomer
</ejb-relationship-role-name>
<multiplicity>one</multiplicity>
<relationship-role-source>
<ejb-name>B2CIndividualCustomer</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
My weblogic-rdbms-jar.xml relationship setup is -
<weblogic-rdbms-relation>
<relation-name>IndividualCustomer-B2CIndividualCustomer</relation-name>
<weblogic-relationship-role>
<relationship-role-name>B2CIndividualCustomer-IsA-IndividualCustomer
</relationship-role-name>
<relationship-role-map>
<column-map>
<foreign-key-column>IndividualCustomerID</foreign-key-column>
<key-column>IndividualCustomerID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>