此处只讨论外键一对一双向映射
有外键的一方:
@OneToOne(fetch = FetchType.LAZY) @JoinColumn(name = "device_id_") private DeviceInfo deviceInfo;
另一边:
@OneToOne(mappedBy = "deviceInfo") private SiteInfo siteInfo;
即可!
2023-10-17 14:39:22
此处只讨论外键一对一双向映射
有外键的一方:
@OneToOne(fetch = FetchType.LAZY) @JoinColumn(name = "device_id_") private DeviceInfo deviceInfo;
另一边:
@OneToOne(mappedBy = "deviceInfo") private SiteInfo siteInfo;
即可!