Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: JPA - difficulty deleting rows (with child fkeys)
PostPosted: Fri Jun 15, 2012 3:30 pm 
Newbie

Joined: Wed Sep 14, 2011 12:36 am
Posts: 4
I have a parent table and want to delete a row but it has 'child' tables with foreign keys pointing to the primary key in the parent table.

We support four DBMS (Oracle, MySQL, PostgreSQL, SQL Server) and are adding more.

The table structure is such that the child tables have child tables and so on, probably if you follow it, 15 tables in all need a row deleted to just delete a row in a parent table.

I need a database agnostic way to 'delete cascade' a row, even if the table was not created with this option. In other words the framework would recursively find the leaf rows, delete those first and then work it's way up to the parent table and report any problems or throw an exception if this were the case.

I am looking for any/all solutions from anyone who has actually done this and was able to get it to work on multiple databases or any of the databases listed above.

thanks


J.V.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.