Relationship between composite key classes → error: not mapped to a single property

2

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;
    
asked by anonymous 08.04.2015 / 21:41

1 answer

0

I have not yet been able to run the application because there are other problems to be solved, but doing so the compiler stopped complaining about this issue:

@JoinColumn(name = "FK_F", referencedColumnName = "fkF", nullable = false, insertable = false, updatable = false), @JoinColumn(name = "FK_F_V", referencedColumnName = "id", nullable = false, insertable = false, updatable = false)

In the referencedColumnName, I indicated the field name in the referenced entity, FVariation, and not in the @Embedabble object FVariacaoPK, as I was doing

Although he did not understand the situation very much, the problem was no longer accused.

    
14.04.2015 / 21:17