近期用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;
时间: 2024-10-11 18:28:24