My TableX has reference to TableY.
@JoinColumn(name = "idTableY", referencedColumnName = "idTableY")
@ManyToOne(optional = false, fetch=FetchType.LAZY)
private TableY idTableY;
and I get this error.
<openjpa-2.0.0-r422266:935683 fatal user error> org.apache.openjpa.persistence.ArgumentException
"com.mycompany.entities.TableX.idTableY" has columns with targets, but OpenJPA does not support any joins on this mapping in this context.
Table Y has this code:
@OneToMany(cascade = CascadeType.ALL, mappedBy = "idTableY")
private Collection<TableX> tableXCollection;
This generated eclipse-link code is 100% normal ( all other entities/tables with similar code have no problems).
But a couple of these are giving such errors. Any idea why?
Try to remove the
@JoinColumndefinition it is unnecessary. The join column containing foreign key is generated automatically. Entity is not a table those are two different things. Entity is class mapped on db table(s).