-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Application Double to Database Integer mapping
PostPosted: Sat Jun 05, 2010 9:49 am 
Newbie

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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.