users@glassfish.java.net

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

From: <glassfish_at_javadesktop.org>
Date: Mon, 16 Jul 2007 16:49:33 PDT

According to the spec, using "cascadeType.REMOVE" (or ALL) should result in the deletion of children (and entries in the join table, if applicable) when calling "remove" on the parent.

I'm finding that TopLink does not actually do this, at least as of "Sun Java System Application Server 9.1 (build b52-rc)". There is an issue logged (1597) where this problem is claimed as resolved as of build 45, but apparently it has not yet been included.

I am able to reproduce this problem - if I call "remove" on a parent, the database reports an error when the row in the child's table is removed but the entry in the join table is not. The only workaround until this is fixed is to remove the reference in the collection, update the parent, remove the child, and then you may remove the parent.
[Message sent by forum member 'msell' (msell)]

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