-->
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: Specifying how BigDecimal should be truncated when stored
PostPosted: Mon Aug 06, 2007 8:07 pm 
Newbie

Joined: Mon Sep 04, 2006 9:53 pm
Posts: 4
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.1 (but I think the same issue applies to 3.2)

Name and version of the database you are using:db2

Hi all,

I am working on a project where I want to save big_decimal properties in NUMERIC columns.

DB2 has a restriction that the "Decimal and integer constants may contain a maximum of 31 significant digits." (http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/rzala/rzalamsg.html?notoc search for SQL405).

Due to accumulation of decimal places during multiplication of input BigDecimals I am getting properties with values like 5550325.97735452066038121606404282835611887230560522 (way more than 31 significant digits).

From reading the reference manual, the "Java Persistence with Hibernate" and the forum posts, I get the feeling that the specification of scale and precision, sql-type and length in the mapping file are for DDL generation and not for converting the values that are stored.

Is there a way of specifying how BigDecimals should be truncated/rounded when they is stored?

It looks like the normal solution is to use a UserType but I would prefer to do this by configuration in the mapping file.

Could someone please provide instructions and/or a reference for the mapping configuration or a confirmation that UserType is the normal solution. Or tell me that neither of these is the right thing to do and that I need to <fill in the blanks>

Ta muchly,
VB


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.