Bugs item #1035970, was opened at 2004-09-28 00:31
Message generated for change (Comment added) made by starksm
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=1035970&group_id=22866

Category: JBossCMP
Group: v3.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Alexei Yudichev (sflexus)
Assigned to: Alexey Loubyansky (loubyansky)
Summary: Foreign key violation during cascade delete

Initial Comment:
JBoss 3.2.5, JDK 1.4.2_04, Linux.

I have CMP Entity Customer and CMP entity Album with 
the following relationships:
1) 1 Customer has Many Albums
2) 1 Customer has 1 Album "Inbox"
3) 1 Customer has 1 Album "Private"
4) 1 Customer has 1 Album "Recycle Bin"

So basically there are 3 Albums each of which has double 
relationship to Customer, both 1-1 and 1-M

Relationship (1) has cascade-delete on Album side, so if 
customer is deleted, all his albums should be deleted. 
Relationships (2)-(4) has NO cascade-delete setting, 
since (1) should be enough, as it references ALL 
customer's albums, including those referenced in (2)-(4).

There are other entities related to Customer in the 
application, but they seem non-important (at first sight).

If I try to remove Customer instance, I get foreigh key 
violation in the database. All foreign keys were created 
by JBoss itself. I have attached TRACE-level log. What 
happens is that all 3 albums (inbox, private and recycle 
bin, their IDs are 162, 163 and 164) are scheduled for 
cascade delete, but only the one with ID=164 is updated 
to set its CMR column to NULL before issuing DELETE 
FROM Customer SQL. The foreign key fk_album_owner 
which is being violated corresponds to relation (1) "1 
Customer has Many Albums".

The interesting thing is that if I redeploy the application 
and issue remove again, it completes normally! Looks like 
it depends on some cache state.

Two files are attached. First one demonstrates foreign 
key violation, second one demonstrates success deletion 
after application is redeployed.

----------------------------------------------------------------------

Comment By: Scott M Stark (starksm)
Date: 2004-12-29 12:52

Message:
Logged In: YES 
user_id=175228

All issues have been moved to http://jira.jboss.com. Existing
issues have been moved. New issues will be closed with this
canned reponse.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=1035970&group_id=22866


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-Development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to