JPA Annotations for Relationships
Relationships are persistent fields in persistable classes that reference other entity objects. The four relationship modes are represented by the following annotations:
- javax.persistence.ManyToMany - JPA Annotation
- javax.persistence.ManyToOne - JPA Annotation
- javax.persistence.OneToMany - JPA Annotation
- javax.persistence.OneToOne - JPA Annotation
Unlike ORM JPA implementations, ObjectDB does not enforce specifying any of the annotations above. Specifying a relationship annotation enables configuring cascade and fetch policy, using the following enum types:
Additional annotations are supported by ObjectDB for the inverse side of a bidirectional relationship (which is calculated by a query) :
Details about all these annotations are provided in Chapter 2 of the ObjectDB manual.