-->
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: BigDecimal DataType in Hibernate for Datacom DB
PostPosted: Thu Jan 19, 2012 1:18 am 
Newbie

Joined: Thu Jan 19, 2012 1:08 am
Posts: 1
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.


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.