JPA 常见@OneToMany,@ManyToOne,@OneToOne映射
程序员文章站
2022-04-12 18:01:26
...
JPA 常见@OneToMany,@ManyToOne,@OneToOne映射
@ManyToOne(fetch = FetchType.EAGER, optional = true)
//@JoinColumn(name="to_loc_no",referencedColumnName="life_cycle", insertable = false, updatable = false)
@JoinColumns ({
@JoinColumn(name="to_dept_no",referencedColumnName = "life_cycle",insertable = false, updatable = false),
@JoinColumn(name="to_loc_no",referencedColumnName = "oid",insertable = false, updatable = false)
})
//to_dept_no, to_loc_no is in epoDetail table
//life_cycle, oid is in epoHeader table
private EpoHeader epoHeader;
@OneToMany(fetch = FetchType.EAGER)
//@JoinColumn(name="to_loc_no",referencedColumnName="life_cycle", insertable = false, updatable = false)
@JoinColumns ({
@JoinColumn(name="to_dept_no",referencedColumnName = "life_cycle",insertable = false, updatable = false),
@JoinColumn(name="to_loc_no",referencedColumnName = "oid",insertable = false, updatable = false)
})
//to_dept_no, to_loc_no is in epoDetail table
//life_cycle, oid is in epoHeader table
private List<EpoDetail> epoDetails;
@OneToOne(fetch = FetchType.EAGER, optional = true)
@JoinColumns ({
@JoinColumn(name="form_no",referencedColumnName = "form_no",insertable = false, updatable = false),
@JoinColumn(name="form_type",referencedColumnName = "form_type",insertable = false, updatable = false)
})
//name="form_no", name="form_type" is in epoHeader
//referencedColumnName = "form_no", referencedColumnName = "form_type" is in EpoForklift
private EpoForklift epoForklift;
@OneToMany(fetch = FetchType.EAGER)
// forklift_oid is in EpoForklift
// oid is in EpoForkliftSetup
@JoinColumn(name = "oid", referencedColumnName = "forklift_oid", insertable = false, updatable = false)
private List<EpoForkliftSetup> epoForkliftConfigs;
上一篇: 软件架构设计的变革及演进
下一篇: ubuntu下不同输入法安装
推荐阅读
-
hibernate映射数据库时@ManyToOne和@OneToMany_MySQL
-
hibernate映射数据库时@ManyToOne和@OneToMany_MySQL
-
JPA中配置ManyToOne和OneToMany的双向
-
@Lazy和@Proxy,关联关系@OneToOne,@OneToMany,@ManyToOne,@ManyToMany
-
JPA中关联关系(OneToOne、OneToMany、ManyToMany,ManyToOne)映射代码片段
-
JPA中关联关系(OneToOne、OneToMany、ManyToMany,ManyToOne)映射代码片段
-
JPA OneToMany映射
-
JPA OneToOne映射
-
Spring Boot学习笔记(五)Spring Data Jpa 快速上手(四)多对一@ManyToOne、一对多@OneToMany,以及级联操作
-
JPA 常见@OneToMany,@ManyToOne,@OneToOne映射