您的位置:首页 > 移动开发

JPA Multiple writable mappings exist for the field [{0}]. Only one may be defined as writable, all o

2011-11-14 22:41 579 查看
使用JPA进行数据操作,在ManyToOne 和OneToMany中,很容易遇到如下问题。

遇到的问题:Multiple writable mappings exist for the field [{0}]. Only one may be defined as writable, all others must be specified read-only.

解决方案是:在 @JoinColumn中加入updatable=false,insertable=false

@ManyToOne(optional=false)

@JoinColumn(name="RECORD_ID",nullable=false, updatable=false,insertable=false)

private Record record;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐