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,040,783
  • 362
  • 3,548
  • 3,513
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
  • 10,997
  • 11
  • 52
  • 81