Hi,
I have a difficult mapping issue. I am mapping a legacy database and there is a problematic of datatype for a one-to-many mapping between 2 tables: Parent to Children.
I have a Parent that is linked to a Set of Childrens:
Code:
<set name="childrens" lazy="true" inverse="true">
<key foreign-key="FinancialTransit">
<column name="transit" scale="10"
precision="0" not-null="false" unique="true" />
</key>
<one-to-many
class="com.eg.Children" />
</set>
The problem I have is that the data-type of Parent.FinancialTransit is a NUMERIC and the data-type of Children.transit is a CHAR!
So I would need to put a formula somewhere to tell Hibernate to convert the FinancialTransite from NUMERIC to CHAR before comparing it to transit. Is that possible? I know I could do this in SQL, but in Hibernate mapping I am not sure how to do this.
This would be the formula:
Code:
convert(VARCHAR(3), FinancialTransit)
Thanks
Etienne.