cancel
Showing results for 
Search instead for 
Did you mean: 

Cascade Delete and JDO

Former Member
0 Kudos

Hello,

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

Regards, Udo

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

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

Former Member
0 Kudos

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