openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Boblitz John <John.Bobl...@BERTSCHI.com>
Subject AW: JPA - difficulty deleting rows (with child fkeys)
Date Mon, 18 Jun 2012 05:55:36 GMT
This may sound like a silly question, but are you using the CascadeType?

Also the @ElementDependant annotation might help <- I use this and it works.

Maybe an example of your mappings might help ...

John 

> -----Urspr√ľngliche Nachricht-----
> Von: J.V. [mailto:jvsrvcs@gmail.com] 
> Gesendet: Freitag, 15. Juni 2012 20:57
> An: users@openjpa.apache.org
> Betreff: JPA - difficulty deleting rows (with child fkeys)
> 
> 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.
> 
Mime
View raw message