java - How do I map a BigDecimal in Hibernate so I get back the same scale I put in? -


in java, new bigdecimal("1.0") != new bigdecimal("1.00") i.e., scale matters.

this apparently not true hibernate/sql server, however. if set scale on bigdecimal particular value, save bigdecimal database via hibernate , re-inflate object, bigdecimal different scale.

for instance, value of 1.00 coming 1.000000, assume because we're mapping bigdecimals column defined numeric(19,6). can't define column required scale need store both dollar , yen values (for example) in same column. need represent bigdecimals numeric types in database benefit of external reporting tools.

does there exist hibernate usertype maps bigdecimal "properly", or have write own?

just informational sake, can tell creation of bigdecimal coming database done proprietary jdbc driver's implementation of 'getbigdecimal' method of database-specific 'resultset' sub-class.

i found out stepping thru hibernate source code debugger, while trying find answer own question.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -