2

Is this a bidirectional one-to-many relationship?

Booking class:

@OneToMany(cascade=(CascadeType.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;
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Daniel
  • 147
  • 8

1 Answers1

2

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

Alfredo Osorio
  • 11,297
  • 12
  • 56
  • 84