I have problem with composite primary key and Foreign key having the same column.
Example
Table A PK (ID , NEW_ID)
Table B PK (ID, NEW_ID) FK (A_ID, NEW_ID)
when I used the below way in the child B when referring A
@ManyToOne @JoinColumns({@JoinColumn(name = "A_ID", referencedColumnName = "ID"), @JoinColumn(name = "NEW_ID", referencedColumnName = "NEW_ID")}) When I try to save B. I am getting an error of invalid Index.
So I am guessing it was also trying to set NEW_ID two times and getting this error.
I have no option to set one column as insertable and updatable as false.
Can any one help me in this
|