我在使用JPA遇到问题“ ORA-00918”,这是我所在实体的一部分,问题是:
@ManyToOne
@NotFound(action = NotFoundAction.IGNORE)
@JoinColumns({
@JoinColumn(name = "INSTITUCION_ID", referencedColumnName = "INSTITUCION_ID", nullable = false),
@JoinColumn(name = "UNIDADGESTORARH_ID", referencedColumnName = "UNIDADGESTORARH_ID", nullable = false),
@JoinColumn(name = "IDPERSONA", referencedColumnName = "IDPERSONA", nullable = false)
})
RhPersonaUrhis rhPersonaUrhis;
@ManyToOne
@NotFound(action = NotFoundAction.IGNORE)
@JoinColumns({
@JoinColumn(name = "INSTITUCION_ID", referencedColumnName = "INSTITUCION_ID", nullable = false, insertable = false, updatable = false),
@JoinColumn(name = "UNIDADGESTORARH_ID", referencedColumnName = "UNIDADGESTORARH_ID", nullable = false, insertable = false, updatable = false),
@JoinColumn(name = "IDHABDESC", referencedColumnName = "IDHABDESC", nullable = false, insertable = false, updatable = false)
})
CrhHabdescInstit crhHabdescInstit;
@Column(length = 6, nullable = false)
@Size(max = 6, min = 1)
@Basic(optional = false)
@NotNull
String idhabdesc;
正如你们看到的,我有两个使用域INSTITUCION_ID和UNIDADGESTORARH_ID的复合@JoinColumns,并且我们知道在两个@JoinColumns之一中都必须标记为insertable = false,可更新= false,如果我们标记一个joincolumn,他们必须使insertable = false,可更新= false
这迫使我添加一个@Column字段,称为“ idhabdesc”,以便能够在oracle中持久保存并且起作用,但是问题是当我使用该实体进行查找时抛出错误。你能帮忙吗?
非常感谢您