Hi,
i have an advanced many-to-one association with a formula.
hbm mapping table1:
Code:
...
<many-to-one name="wp" class="myclass.Table2" property-ref="myJoin" insert="false" update="false" lazy="false" not-found="ignore">
<formula>'PDI'</formula>
<column name="ID"/>
</many-to-one>
...
hbm mapping table2:
Code:
PK(ID)
...
<properties name="myJoin" update="false" insert="false">
<property name="type" type="string" update="false" insert="false" >
<column name="MY_TYPE" />
</property>
<property name="id2" type="big_integer" update="false" insert="false">
<column name="ID" />
</property>
...
The generated sql:
Code:
select
...
FROM
table1 this_
LEFT OUTER JOIN
table2 table2_
ON
'PDI' = table2_.MY_TYPE
AND this_.ID = table2_.ID
AND table2_.MY_TYPE= 'PDI'
WHERE
...
Why is in the join condition the additional expression:
AND table2_.MY_TYPE= 'PDI' ? I have expected only the expression: 'PDI' = table2_.MY_TYPE
Regards!
Hibernate version: 3.1.3