玩转JPA(一)---异常:Repeated column in mapping for entity/should be mapped with insert="false" update="fal

最近用JPA遇到这样一个问题:Repeated column in mapping for entity: com.ketayao.security.entity.main.User column: org_id (should be mapped with insert="false" update="false")

这个错误是由实体类引起的,我一开始是这样写的:

@Column
private long orgId;

@ManyToOne
@JoinColumn(name="orgId")
private Organization organization;

在这里get和set方法就省略了。

修改为下面这样就好:

@Column(insertable=false,updatable=false)
private long orgId;

@ManyToOne
@JoinColumn(name="orgId")
private Organization organization;

玩转JPA(一)---异常:Repeated column in mapping for entity/should be mapped with insert="false" update="fal,,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。