I am on Weblogic 8.1 server, sp2, and SQL Server 2000 for the database. I am having
a problem getting ejb 2.0 relationships and specifically getting the
deletes to act in the correct order. I have a B2C (business to consumer) Customer
bean, and Individual CustomerBean. I set up a uni-directional ejb 2.0 relationship
from Individual bean to B2C bean. I set up a foreign key reference in the
SQL Server 2000 database, base table of Individual Customer, foreign key field pointing to B2C customer table.
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 -
My weblogic-rdbms-jar.xml relationship setup is -