Multiple writable mappings exception in EclipseLink

雨燕双飞 提交于 2019-11-30 05:58:47
klonq

The proper way to do this is to use @PrimaryKeyJoinColumn instead of plain old @JoinColumn.

reference wiki example on PrimaryKeyJoinColumn

Valter Silva

I solved my problem placing the insertable=false, updatable=false in the @JoinColumn annotation in both classes, Person and Company.

My guess is that you have the id_user mapped twice, once using a Basic @Id mapping, and once using the @ManyToOne. You need to make one of them read-only, i.e. insertable/updatable=false. Or better, just remove the basic id, and put the @Id on the @ManyToOne.

See, http://en.wikibooks.org/wiki/Java_Persistence/Identity_and_Sequencing#Primary_Keys_through_OneToOne_and_ManyToOne_Relationships

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!