Hi all !
I have a composite primary key composed by one foreing key from one schema and another foreign key from another different schema, and also another field that is not a foreign key, here is the code.
Code:
@Table(name = "TABLE_A", schema="SCHEM_A")
public class Ejercicio implements java.io.Serializable {
private TableAId id;
@SuppressWarnings("serial")
@Embeddable
public class TableAId implements java.io.Serializable {
@Column(name = "ID_TABLE_A", nullable=false)
private Integer idTableA;
@JoinColumn(name = "ID_COLUM_B")
@ManyToOne
private ColumnB idColumB;
@JoinColumn(table="SCHEMA_B.TABLE_B", name = "ID_TABLE_B")
@ManyToOne
private TABLE_B idTableB;
When we try to execute this HQL query, "select A from TABLE_A A" this exception is thrown:
Code:
com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -206, SQLSTATE: 42703, SQLERRMC: TABLE_A0_.IDTABLE_A