File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Oracle/OAS and the fly likes Deleting parent->child with inverse foreignkey Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Deleting parent->child with inverse foreignkey" Watch "Deleting parent->child with inverse foreignkey" New topic

Deleting parent->child with inverse foreignkey

Mads jacobsen

Joined: Nov 20, 2008
Posts: 7
Hi all

i've run into a small problem.

It might be that the solution is obvious, and i just don't see it.

I have a bunch on tables.

I wish to delete a row from the PARENT table, and each corresponding rows from the 3 CHILDX tables.

If the relationship was the other way around, i would just smack a ON DELETE CASCADE constraint on, and live happily ever after.

Does anyone have a suggestion which could point me in the right direction?

I know i essentially have 3 parents and 1 child here, and that the best solution would probably be to inverse the relationship, but this is unfortunatly not an option for me.

btw this is on Oracle Database 11g Enterprise Edition Release if that matters

Thank you in advance for your time.
Mads jacobsen

Joined: Nov 20, 2008
Posts: 7
In the end i solved this using a stored procedure.

Its not really how i wanted to go around it, and from a maintanance point of view its awefull, but given that the structure had a great amount of tables i saw no other choice.
Consider Paul's rocket mass heater.
subject: Deleting parent->child with inverse foreignkey
It's not a secret anymore!