Hibernate version: 2.1.6
Mapping documents:
<property
name="authorizedAmount"
type="java.lang.Float"
update="true"
insert="true"
access="property"
>
<column
name="authorizedAmount"
not-null="true"
sql-type="NUMBER(15,3)"
/>
Name and version of the database you are using: Oracle 9i, thin driver
The generated SQL (show_sql=true): update fin.xxx_credit_Limit set dbversion=?, maturity=?, maturityEnd=?, text=?, remarks=?, authorizedAmount=?, fk_limit_info=?, fk_xxx_cg_member=? where id=? and dbversion=?
Debug level Hibernate log excerpt:
22:49:46,880 DEBUG EntityPersister:648 - Updating entity: [com.xxx.fi.model.hibernate.XXXCorporateGroupMemberCreditLimitHPB#11000188]
22:49:46,880 DEBUG EntityPersister:649 - Existing version: 7 -> New version: 8
22:49:46,880 DEBUG BatcherImpl:200 - about to open: 0 open PreparedStatements, 0 open ResultSets
22:49:46,900 DEBUG SQL:226 - update fin.xxx_credit_Limit set dbversion=?, maturity=?, maturityEnd=?, text=?, remarks=?, authorizedAmount=?, fk_limit_info=?, fk_xxx_cg_member=? where id=? and dbversion=?
Hibernate: update fin.xxx_credit_Limit set dbversion=?, maturity=?, maturityEnd=?, text=?, remarks=?, authorizedAmount=?, fk_limit_info=?, fk_xxx_cg_member=? where id=? and dbversion=?
22:49:46,900 DEBUG BatcherImpl:249 - preparing statement
22:49:46,900 DEBUG EntityPersister:388 - Dehydrating entity: [com.xxx.fi.model.hibernate.XXXCorporateGroupMemberCreditLimitHPB#11000188]
22:49:46,900 DEBUG IntegerType:46 - binding '8' to parameter: 1
22:49:46,900 DEBUG StringType:46 - binding '2006' to parameter: 2
22:49:46,910 DEBUG StringType:46 - binding '2008' to parameter: 3
22:49:46,910 DEBUG CharacterType:46 - binding 'S' to parameter: 4
22:49:46,910 DEBUG StringType:46 - binding 'lkh' to parameter: 5
22:49:46,910 DEBUG FloatType:46 - <b>binding '2.555' to parameter: 6</b>
22:49:46,910 DEBUG LongType:46 - binding '1920' to parameter: 7
22:49:46,920 DEBUG Cascades:396 - version unsaved-value strategy UNDEFINED
22:49:46,920 DEBUG Cascades:341 - id unsaved-value strategy NULL
22:49:46,930 DEBUG LongType:46 - binding '11' to parameter: 8
22:49:46,930 DEBUG LongType:46 - binding '11000188' to parameter: 9
22:49:46,930 DEBUG IntegerType:46 - binding '7' to parameter: 10
22:49:55,062 DEBUG BatcherImpl:207 - done closing: 0 open PreparedStatements, 0 open ResultSets
22:49:55,062 DEBUG BatcherImpl:269 - closing statement
22:49:55,062 DEBUG SessionImpl:2824 - post flush
22:49:55,062 DEBUG SessionImpl:585 - transaction completion
22:49:55,072 DEBUG JDBCTransaction:103 - re-enabling autocommit
22:49:55,072 DEBUG HibernateUtil:171 - Closing Session of this thread.
22:49:55,072 DEBUG SessionImpl:573 - closing session
22:49:55,072 DEBUG SessionImpl:3336 - disconnecting session
22:49:55,072 DEBUG SessionImpl:585 - transaction completion
We are facing a strange problem with mapping a java.lang.Float value to a NUMBER(15,3) field in Oracle (9i, thin driver). The decimal places are cut upon any update.
Hibernate clearly assigns the value 2.555 to the statement, but the database reads 2.000 after the update.
This might be a JDBC level problem, but we really don't think that we are the first ones who store a Float object into a NUMBER field, so it's kind of strange.
Does anyone know the reason for this ? Any solutions available ?
|