Skip to main content

[JSR-354] Fwd: [jsr338-experts] Arbitrary precsion value in JPA

  • From: Werner Keil <werner.keil@...>
  • To: jcurrency_mail@...
  • Subject: [JSR-354] Fwd: [jsr338-experts] Arbitrary precsion value in JPA
  • Date: Mon, 4 Feb 2013 19:38:08 +0100


Something I picked up from JPA. While JPA and Java EE related JSRs like CDI may not be in immediate scope of 354, persistence support and other aspects like BeanValidation, etc. will become relevant one way or the other. Thus something about precision (loss) always sounds interesting at least in the long term.


---------- Forwarded message ----------
From: Pinaki Poddar <ppoddar@...>
Date: Mon, Feb 4, 2013 at 7:16 PM
Subject: [jsr338-experts] Arbitrary precsion value in JPA
To: jsr338-experts@...


The spec should mention some more details about the value of a persistent property of arbitrary-precision numbers such as BigDecimal type.

For example, if the application defines a BigDecimal field with scale = 2 and sets a value of 1234.56789, then
a) will the value be stored in database as 1234.56 (i.e. losing precision)?

b) If the field were declared without a scale parameter, then would the column value be the same as the in-memory value of 1234.56789?

c) If the provider is responsible for rounding the in-memory value, then what is the rounding mode?

I have few more questions, but as a starter if some clarifications are available for the above questions, it will be helpful.

Regards --

Pinaki Poddar                          
Chair, Apache OpenJPA Project 
JPA Expert Group Member

[JSR-354] Fwd: [jsr338-experts] Arbitrary precsion value in JPA

Werner Keil 02/04/2013
Please Confirm