Skip to Content
author's profile photo
Former Member

Cascade Delete and JDO


is it possible to trigger cascading deletes on JDO objects automatically ?

Regards, Udo

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Posted on Jul 15, 2004 at 07:42 AM

    Hi Udo,

    There was a long debate in the JDO 1.0 expert group on how to express cascading deletes: declaratively or programmatically. Well, they decided in favor of the programmatic approach.

    In order to implement cascading deletes in JDO, you have to make use of the jdoPreDelete instance callback method. jdoPreDelete is called on the JDO instance just right before the instance is "deleted". Simply call deletePersistent on the referenced objects and collections.



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member


      I'm a little new to JDO and we're trying to implement this functionality. Could you please show a simple pseudo code explaining this preDelete. Something like deleting an employee which automatically deletes the employee from the department would be helpful. Also, will this work for a many to many relationship?