Java Persistence API - annotations - III
26 July 2008Continued from the lasr 2 posts.
If each entity instance is related to a single instance of another entity, then one-to-one relation exists and
@OneToOne(javax.persistence.OneToOne) is used.
If an entity instance can be related to multiple instances of other entities, then one-to-many relation exists and
@OneToMany(javax.persistence.OneToMany) is used.
If multiple instances of an entity can be related to a single instance of the other entity,then many-to-one relation exist and
@ManyToOne(javax.persistence.ManyToOne) is used.
If entity instances can be related to multiple instances of each other, then we say that many-to-many relation exist and @ManyToMany (javax.persistence.ManyToMany) is used.
Related Posts:
- Java Persistence API - annotations - I
- Java Persistence API - annotations - II
- No Persistence provider for EntityManager
- Categories of annotations
- Categories of annotations
- JDO – Byte Code Enhancement
- Custom annotations - default values - I
- Defining annotations
- Custom annotations - default values - III
- Custom annotations - Adding a member - I
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Java Persistence API - annotations - III