Is this a bidirectional one-to-many relationship?
Booking class:
@OneToMany(cascade=(Casca开发者_JAVA百科deType.ALL), fetch=FetchType.EAGER, mappedBy = "customer")
private List<Booking> bookings = new ArrayList<Booking>();
Customer class:
@ManyToOne(cascade={CascadeType.ALL}, fetch=FetchType.EAGER)
@JoinColumn(name = "custNo", referencedColumnName = "customerNo")
private Customer customer;
Bidirectional means that both entities refer to each other. So yes it is a bidirectional relationship.
For more information on One-to-Many and Many-to-One relationship please refer to JPA 2.0 Spec (Section 2.10.2).
http://jcp.org/aboutJava/communityprocess/final/jsr317/index.html
精彩评论