主表
@FrontField(description
="旷工统计汇总")
@OneToOne(mappedBy
="attendanceOriginal")
private VariousHoursStatistics vHoursStatistics
;
子表
@JsonBackReference
@FrontField(description
="考勤ID")
@OneToOne(fetch
=javax
.persistence
.FetchType
.EAGER
)
@JoinColumn(name
= "attendance_original_id")
private AttendanceOriginal attendanceOriginal
;
两边set后各自保存
vHoursStatistics.setAttendanceOriginal(attendanceOriginal); attendanceOriginal.setVHoursStatistics(vHoursStatistics); variousHoursStatisticsService.save(vhsEntity); attendanceOriginalService.save(entity);