作者:xinweiss | 来源:互联网 | 2023-09-25 20:34
本文由编程笔记#小编为大家整理,主要介绍了java JPA中的单向OneToMany关系相关的知识,希望对你有一定的参考价值。
The Owner (The "many" side):
@Id
@Column(name="Id")
private Long id;
@Column(name = "ProductId", insertable = false, updatable = false)
private Long productId;
The "One" side:
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "ProductId", referencedColumnName = "Id", nullable = false)
private List things = new ArrayList<>();