If I write this way
@Id
@OneToOne
@JoinColumn(name="Id")
private Region region;
it says
Composite-id class must implement Serializable: ....InPopulation
I don't want it be composite key, I just want id
replaced by Region
of appropriate id.
You use the MapsId
annotation for that (i have assumed how the @Id is declared):
@Id
private Long id;
@JoinColumn(name = "Id")
@OneToOne
@MapsId
private Region region;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.