Skip to Content
avatar image
Former Member

Cascade Delete and JDO

Hello,

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

  • 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.

    Regards,

    Christian

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello,

      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?

      Thanks,

      Dustin