I have a VARIANCE class that has a compound key (FK_T, FK_F, FK_F_VARIACAO). Two of these primary key fields (FK_F, FK_F_VARIACAO) are also foreign key to the FARIA table, in a ManyToOne relationship
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumns({
@JoinColumn(name = "FK_F", referencedColumnName = "FK_F", nullable = false, insertable = false, updatable = false),
@JoinColumn(name = "FK_F_V", referencedColumnName = "ID", nullable = false, insertable = false, updatable = false) })
@NotNull
private FVariacaoTO fVariacaoTO;
The class FVariacaoTO has two primary keys, which are being referenced, within a class FKPariance.
I'm getting the following ERROR : referencedColumnNames (FK_F, ID) from CVARATION.FVARATION not mapped to a single property
What usually causes this error? How can I resolve this relationship?
EDIT: Additional information.
In class FVariacaoTO, the key is as @EmbeddedId, as follows:
@EmbeddedId @AttributeOverrides({ @AttributeOverride(name = "fkF", column = @Column(name = "fkF", nullable = false)), @AttributeOverride(name = "id", column = @Column(name = "id", nullable = false)) }) @NotNull private FVariacaoPK fVariacaoPK;
And in the FVariacaoPK class, which has this ID indicated in @EmbeddedId, it looks like this:
@Column(name = "FK_F", nullable = false) private int fkF;
@Column(name = "ID", nullable = false) private int id;