I think its a bug; I am running into the same problem. I have a legacy database I need to join into using something other than the main objects primary key and it simply wont let me join on any field other than the primary key.
No matter what I insert into "property-ref" it ALWAYS uses the objects primary key in the inner join:
Code:
<join table="PUSRPRF" inverse="true">
<key column="I_USER_LDAP" property-ref="tid" />
<property name="firstName" type="string" column="N_FIRST" />
<property name="lastName" type="string" column="N_LAST" />
</join>
results in:
Quote:
could not execute query:
[select hperson0_.I_PERSN_IBSC as I1_4_, hperson0_.T_STMP_UPD as T2_4_, hperson0_.I_USER_UPD as I3_4_, hperson0_.I_USER_LDAP as I4_4_, hperson0_.N_USER_LDAP as N5_4_, hperson0_1_.N_FIRST as N2_5_, hperson0_1_.N_LAST as N3_5_ from T5279KN.PIBPERSN hperson0_ left outer join T5279KN.PUSRPRF hperson0_1_ on hperson0_.I_PERSN_IBSC=hperson0_1_.I_USER_LDAP where hperson0_.I_USER_LDAP like ?]
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/6000] SQL0401N The data types of the operands for the operation "=" are not compatible. SQLSTATE=42818
Where the inner join SHOULD be hperson0_.I_USER_LDAP =hperson0_1_.I_USER_LDAP. I_PERSN_IBSC is the primary key.
Is there a work around to this? If its a known problem has there been a patch jar released that I can deploy?
Thanks[/b]