Collection Mapping related annotations
Annotations | Definition |
---|---|
@OneToMany | This annotation can be used to define the one-to-many relationship between the two entities. Attributes:
|
@ManyToOne | This annotation is used to defines the many to one relationship between the two entities. Attributes:
|
@ManyToMany | This annotation defines the many to many relationship between the two entities. Attributes:
|
@ElementCollection | This annotation can be used to define the collection of the basic or the embeddable tables. Attributes:
|
@JoinTable | This annotation specifies the mapping of the many to many relationships using the join table. Attributes:
|
@OrderBy | This annotation specifies the ordering of the elements in the collection. Attributes:
|
JPA – Collection Mapping
In Java, JPA can defined as Java Persistence API. Collection Mapping is a powerful feature that allows developers to map relationships between the entities and collections in the database. It allows the developers to map the collections of the objects from Java to corresponding database structures.