| Seems to still affect 5.x: I've to map several tables in a single java bean (1:1); each table share the same foreign-key ('sessionId', an UUID) which is not the primary key (a bigint); so I've tried the following mapping with hibernate 5.0.5.Final:
<class
name="beans.NeutralTable"
table="MeasurementSession"
>
<id column="#id" name="longId" type="long"/>
<property column="@creationtimestamp" name="date1" type="timestamp" />
<property column="sessionId" name="textId" type="string" not-null="true" />
<join
table="ComputationDone"
fetch="join"
optional="true"
>
<key column="sessionId" foreign-key="sessionId" property-ref="textId" not-null="true"/>
<property column="keyData.Isc" name="floating1" type="double" not-null="false"/>
</join>
</class>
Whatever I put on the 'foreign-key' and 'property-ref', hibernate always try to join on the primary key (#id):
Note: the DBMS is postgresql 9.2.x |