Hi ,
I am facing issue with BigDecimal Datatype in Java for Datacom database. We have mapped Column to java.math.BigDecimal with SQL Type as "NUMERIC(6,0)"
<composite-id> <key-property name="mfrNbr" type="java.math.BigDecimal"> <column name="MFR_NBR" sql-type="NUMERIC(6,0)" precision="6" scale="0" not-null="true"/> </key-property> <key-property name="modelNbr" type="java.lang.String"> <column name="MODEL_NBR" sql-type="CHARACTER VARYING(10)" not-null="true"/> </key-property> </composite-id>
When data inserted for above column , it works fine. But while retrieving , it returns null.
Logs: 2012-01-18 20:28:04,335 DEBUG http-bio-8080-exec-14 org.hibernate.jdbc.AbstractBatcher - preparing statement 2012-01-18 20:28:04,556 DEBUG http-bio-8080-exec-14 org.hibernate.type.BigDecimalType - binding '102' to parameter: 1 2012-01-18 20:28:04,587 DEBUG http-bio-8080-exec-14 org.hibernate.type.StringType - binding 'CF' to parameter: 2 2012-01-18 20:28:05,161 DEBUG http-bio-8080-exec-14 org.hibernate.jdbc.AbstractBatcher - about to open ResultSet (open ResultSets: 0, globally: 0) 2012-01-18 20:28:05,190 DEBUG http-bio-8080-exec-14 org.hibernate.loader.Loader - processing result set 2012-01-18 20:28:05,221 DEBUG http-bio-8080-exec-14 org.hibernate.loader.Loader - result set row: 0 2012-01-18 20:28:05,251 DEBUG http-bio-8080-exec-14 org.hibernate.type.BigDecimalType - returning null as column: MFR1_1_
Tried to extend Hibernate dialect with below column types , but still dint work.
Option 1 registerColumnType(Types.NUMERIC, "numeric($p,$s)"); registerHibernateType(Types.NUMERIC, Hibernate.BIG_DECIMAL.getName()); registerHibernateType(Types.DECIMAL, Hibernate.BIG_DECIMAL.getName()); Option 2 registerColumnType(Types.DECIMAL, "numeric($p,$s)"); registerHibernateType(Types.NUMERIC, Hibernate.BIG_DECIMAL.getName()); registerHibernateType(Types.DECIMAL, Hibernate.BIG_DECIMAL.getName()); ......................................
Also does anyone know if hibernate dialect exists for CA Datacom Database.
|