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;
遇到的问题: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;
相关文章推荐
- JPA Multiple writable mappings exist for the field [{0}]. Only one may be defined as writable, all o
- - Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.
- Configuration problem: Only one AsyncAnnotationBeanPostProcessor may exist within the context.
- Only one AsyncAnnotationBeanPostProcessor may exist within the context.
- MySQL错误:Incorrect table definition;there can be only one auto column and it must be defined as a key
- VB6:关于“Only public user defined types defined in public object modules can be used as parameters or return types for public procedures of class modules or as fields of public user defined types.”的编译错误
- Configuration problem: Only one AsyncAnnotationBeanPostProcessor may exist within the context.
- Configuration problem: Only one AsyncAnnotationBeanPostProcessor may exist within the context.
- Dependency xpp3:xpp3:1.1.3.3 is ignored for debug as it may be conflicting with the internal versio
- 修改ListItem时出现Error: Invalid data has been used to update the list item. The field you are trying to update may be read only.
- 单元测试的时候 报出: Only one AsyncAnnotationBeanPostProcessor may exist within the context
- MySQL 数据表创建报错:there can be only one auto column and it must be defined as a key
- 报错 Only one AsyncAnnotationBeanPostProcessor may exist within the context.
- Incorrect table definition; there can be only one auto column and it must be defined as a key
- 1075 - Incorrect table definition;there can be only one auto column and it must be defined as a key
- [Err] 1075 - Incorrect table definition; there can be only one auto column and it must be defined as
- Spring:Configuration problem: Only one AsyncAnnotationBeanPostProcessor may exist within the context
- Configuration problem: Only one AsyncAnnotationBeanPostProcessor may exist within the context.
- 'date' is an invalid value for the SoapElementAttribute.DataType property. The property may only be specified for primitive types.
- Only one AsyncAnnotationBeanPostProcessor may exist within the context.