Home » Support » Forum » Maintaining referential integrity

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.

#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
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login