今天踩了个坑,JPA Hibernate的表名命名规则不同导致的。最佳实践是在定义关系表时候,详细定义join column,比如:
@ManyToMany(
cascade = {CascadeType.ALL}
)
@JoinTable(
name = "Form_Label",
joinColumns = {
@JoinColumn(
name = "form_form_id"
)
},
inverseJoinColumns = {
@JoinColumn(
name = "labels_label_id"
)
}
)
private List<Label> labels;
网友评论