users@glassfish.java.net

Re: Error cascading delete to child item (_at_OneToMany relationship)

From: <glassfish_at_javadesktop.org>
Date: Tue, 17 Jul 2007 16:20:45 PDT

Looks like you hit a known issue, which is documented under
https://glassfish.dev.java.net/issues/show_bug.cgi?id=2991

In your situation, the class mapped to the table fluke_metbase_parameter is the non-owning side of the relationship. Toplink executes removals in reverse lexical order of the class names, causing removals on fluke_metbase_parameter to be executed first.

The workarounds are:
1) Re-name the classes, so that the owning side is lexically later then fluke_metbase_parameter
2) Keep cascade = ALL, but remove the relationships *after* removing the owning side
3) Don't use cascade=REMOVE, and cascade the removal in your code.
[Message sent by forum member 'mf125085' (mf125085)]

http://forums.java.net/jive/thread.jspa?messageID=227033