Problems avoiding cascade deletion in a N-1 relation


claudio_rosati@...
 

Hi all,

I've followed the Unidirectional ForeignKey example for N-1 relations:

public class Account {
    ...
    @Column(name="USER_ID")
    User user;
}

public class User {
    ...
}

I create the User, then the Account and assign the user to it. When I persist the account both user and account are persisted. That's fine. But when I delete the account, also the user is deleted, and this is something I don't want.

I've looked at the JDO annotations, trying few things but I was unable to come to a solution. I can accept to persist myself the User before the Account, but I don't want the user being deleted automatically with the account.

What I'm missing?


Andy
 


claudio_rosati@...
 

Thank you for the link Andy,