MappingTool ignores FK constraints during DELETE

1 message Options
Embed this post
Permalink
Dinkar Rao

MappingTool ignores FK constraints during DELETE

Reply Threaded More More options
Print post
Permalink
Hi Folks,

I run MappingTool with "-schemaAction deleteTableContents", and it looks like OpenJPA issues DELETE statements in alphabetical order of entities. In my application, a DELETE for the parent table is issued before the DELETE for the dependent table can be issued. Both tables are populated, and the parent table DELETE fails because of the default ON DELETE NO ACTION constraint.

Is there a way to tell MappingTool to order its deletes taking into account the RI dependency chain ?

(I could set the MappingDefaults property's ForeignKeyDeleteAction option to 'cascade', so OpenJPA will alter tables for ON DELETE CASCADE, but I am hoping MappingTool can be made to work).

Thanks,
Dinkar