I am getting the below exception while mapping jpa entities.
org.apache.openjpa.persistence.ArgumentException: "com.abc.P1.e1" defines a target of "cd" for column "p_cd", but that target does not exist in table "E1"
I am using multi column FK & have defined the join columns as mentioned below. Please note that cd & ab columns are present in the table E1. They are also foreign keys to other entities(Test1 & Test2) separately. The unique key is also present for combined cd and ab columns in table E1.
could anyone please help to understand what I missed here? Thanks in advance!
@Entity
public class P1 ...{
...
@OneToOne(fetch= FetchType.LAZY)
@JoinColumns({
@JoinColumn(name="p_cd", referencedColumnName="cd"),
@JoinColumn(name="p_ab", referencedColumnName="ab")
})
private E1 e1;
...
}
@Entity
public class E1 ... {
@Id
private long e1_id;
...
@ManyToOne
@JoinColumn(name = "cd")
private Test1 t1;
@ManyToOne
@JoinColumn(name = "ab")
private Test2 t2;
...
}