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