Joined: Thu Jun 03, 2010 11:43 am Posts: 1
|
I have an application where the core calculation engine can handle only double data type(for Numeric) and the entity mode is "dynamic-map". The application uses a shared database which has to be auto created by hibernate schema creation tool. The requirement is as follows:
1.The calculation engine will set only double value(#.0) to the property 2.The database column will have to a SQL integer type
If the mapping xml has the property type as integer, like <property name="Ce25258150b055429d95ae3eeeb3f9cc81" type="java.lang.Integer" column="Number1"/> hibernate throws a class cast exception when the property value is set with a double value. What is the best approach to handle this ?
1. I can handle this in the setter(set integer from double returned by application) and getter(return double to application) of the DAO. 2. Use a Hibernate UserType
Please let me know if anyone has any pointers.
Thanks!
|
|