Re: BigDecimal, scale, and prototypes
Re: BigDecimal, scale, and prototypes
- Subject: Re: BigDecimal, scale, and prototypes
- From: Florijan Stamenkovic <email@hidden>
- Date: Fri, 15 Aug 2008 14:15:02 -0400
On Aug 15, 2008, at 11:45, T Worman wrote:
Florijan:
I have found that setting the scale in the model did not result in
properly setting the scale of the attributes in my EO's. I am using
OpenBase. There could be a number of reasons for this and I didn't
investigate real hard.
The scale of attributes in Java *should* directly reflect the scale
set in the database, due to the way BigDecimal's constructors work,
even if EOF does not intervene.
Wanting to be sure what is happening, I just made a test application
(WO5.3, FrontBase, 10.4.11, wonder currencyAmount prototype). In
short, the database respects the scale of the model. Java respects
the scale too. The scale of fetched BigDecimals is fixed, if not all
of it is used they are zero padded. Who exactly is responsible for
this I am not sure, but it is a pleasantly consistent behavior.
As for the input of BigDecimals that have a scale greater then what
is allowed are rounded (HALF_UP), no exceptions raised. This is a bit
mysterious. From what you guys are saying, it could be concluded that
EOF does not deal with this. If that is so, then it also does not
raise an exception when there is more digits then the model allows.
This does not sound OK, on it's part. If EOF does deal with this
(coercion), Dave should not have received an exception on the db
level, and things should have worked fine for Timothy. Uhm, weird.
What I did was override the getters for those attributes in the
java classes.
Yeah, I was thinking of doing that, but we might be handling high
volumes of this kind of data, the less extra BigDecimal operations I
do, the better.
Thanks,
F
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden