-->
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.  [ 4 posts ] 
Author Message
 Post subject: Value truncation while using decimals in select query
PostPosted: Thu Jun 08, 2006 11:53 am 
Newbie

Joined: Thu Jun 08, 2006 11:38 am
Posts: 3
Hi,

The mapping file for hibernate has the following for a db column.
<column name="ACCNO" length="9" not-null="true" unique="true" sql-type="DECIMAL"/>

this is one of the primary key for my fetch. The value is set in Hibernate prepared statements is 1036479002, but the hibernate Query execution automatically runs the query for 36479002 against the DB.

While I try the query with number 1136479002, the query doenst truncate the numbers.

The generated primary class for this propery is
/**
* @hibernate.property
* name="Accno"
* type="java.math.BigDecimal"
* @hibernate.column
* name="ACCNO"
* length="9"
* not-null="true"
* unique="true"
* sql-type="DECIMAL"
*/

I will be gald to get some help in resolving this issue.

Thanks & Regards,
Pavithra


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 08, 2006 2:58 pm 
Beginner
Beginner

Joined: Fri May 26, 2006 7:15 am
Posts: 20
Location: Vandavasi, TamilNadu
can you post with some more details of your mapping(pk details)

_________________
gajini
------------------


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 12, 2006 12:36 pm 
Newbie

Joined: Thu Jun 08, 2006 11:38 am
Posts: 3
The length of the account number field in the table is 9. And it is a DB2 database. It's type is Decimal.

Hope this helps. Could you please be specific of the details you are looking for.


Top
 Profile  
 
 Post subject: Details from Log
PostPosted: Fri Jun 16, 2006 12:44 pm 
Newbie

Joined: Thu Jun 08, 2006 11:38 am
Posts: 3
Including some details from the log
12:32:57,108 DEBUG Loader:1742 - bindNamedParameters() 1018773107 -> accountNumber [2]
12:32:57,108 DEBUG BigDecimalType:79 - binding '1018773107' to parameter: 2
12:32:57,421 DEBUG AbstractBatcher:327 - about to open ResultSet (open ResultSets: 0, globally: 0)
12:32:57,421 DEBUG Loader:682 - processing result set
12:32:57,421 DEBUG Loader:687 - result set row: 0
12:32:57,421 DEBUG BigDecimalType:123 - returning '18773107' as column: ACCNO22_0_

In the above log the Returned BigDecimalType doesnt return the value of Account number as 1018773107 but as 18773107.

The same happens when I set the account number as 11018773107.

For a decimal if of length 9, if the leftmost 9th element is 0 this problem occurs. I will appretiate any help to resolve this issue.


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

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.