ObjectDB ObjectDB

Maintaining referential integrity

#1

Hi everyone!

I'm facing challenges using Objectdb with pure JPA annotations. Please see the code below:


@Entity
public class Employee {
    @Id
    private long id;
    private Company company;
    ...
}

@Entity
public class Company {
    @Id
    private long id;
    ...
}

When I try to remove an instance of Company, it is deleted from the database, no matter if it's referenced by an instance of Employee. I tried to use annotations like "OneToMany" and "ManyToOne", but the result is the same. What am I supposed to do?

Best regards,

FPS.

edit
delete
#2

Currently ObjectDB doesn't implement referential integrity and it is the application responsibility to avoid such deletion. The ObjectDB Doctor can help in identifying conditions that require a fix during development.

You may subscribe to this new feature request if you need this functionality. Please add your comments regarding this feature (if any) in the issue tracking system.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.