Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Delete order in Many-To-Many

JaraAug 9 2005 — edited Aug 10 2005
Hi,
I have problem with order of delete command in many-to-many relationship.
(JDev 10.1.2, TopLink - 10g (9.0.4.5) (Build 040930))
Let we assume class schema:

Role (N) ------> (N) Task
User (N) -------> (N) Role
User (N) -------> (N) Task

Mapping is many-to-many via relation table (R_RoleTask, R_UserTask, R_UserTask).

Java code
uow.deleteObject(userOne);
uow.deleteObject(userTwo);
uow.deleteObject(roleOne);
uow.deleteObject(taskOne);
uow.deleteObject(taskTwo);
uow.deleteObject(taskThree);
uow.commit();

produces sql
DELETE FROM R_ROLETASK WHERE (ROLE_ID = 13256);
DELETE FROM ROLE WHERE (ID = 13256);
and of course ends with ORA-02292: integritní constraints....

What is magic: last week worked it fine!
DELETE FROM R_USERTASK WHERE (USER_ID = 13303)
DELETE FROM R_USERROLE WHERE (USER_ID = 13303)
DELETE FROM USER WHERE (ID = 13303)
DELETE FROM R_USERTASK WHERE (USER_ID = 13302)
DELETE FROM R_USERROLE WHERE (USER_ID = 13302)
DELETE FROM USER WHERE (ID = 13302)
DELETE FROM R_ROLETASK WHERE (ROLE_ID = 13306)
DELETE FROM ROLE WHERE (ID = 13306)
DELETE FROM TASK WHERE (ID = 13304)
DELETE FROM TASK WHERE (ID = 13305)
DELETE FROM TASK WHERE (ID = 13307)

No change in table definition, no change in TopLink mapping, no change in JDev&TopLink version.
The only one new thing - I created new table and add mapping to TopLink.

So. I think TopLink orders all deletes using the constraints defined. This is right for 1:1 and 1:N. But for N:N?
What can I do?
I tryed addConstraintDependencies, but it don't help.

Thanks for any hint.
Jara

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 7 2005
Added on Aug 9 2005
3 comments
591 views