开发者

Is this a bidirectional one-to-many relationship?

开发者 https://www.devze.com 2023-02-02 23:08 出处:网络
Is this a bidirectional one-to-many relationship? Booking class: @OneToMany(cascade=(Casca开发者_JAVA百科deType.ALL), fetch=FetchType.EAGER, mappedBy = \"customer\")

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

0

精彩评论

暂无评论...
验证码 换一张
取 消