BigDecimal Scale Problem WO5.2.4 [SOLVED], ORACLE 8i jdbc adaptor
"COAST" <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <s3fc67a2.004@CEDES_MSRV1.cedes.local> |
Hi list
sorry for disturbing once again about this topic,
but it may be a help for somebody.
With the help of (the great) eogenerator we solved the BigDecimal Scale Truncating Problem
with a very small effort by customizing the setter-Method:
Template snippet for eogenerator:
public void set<$attribute.name.initialCapitalString$>(<$attribute.javaValueClassName$> aValue) {
<$if attribute.javaValueClassName=="BigDecimal"$>
takeStoredValueForKey(aValue.setScale(<$attribute.scale$>, BigDecimal.ROUND_HALF_UP), "<$attribute.name$>");
<$endif$>
<$if ((attribute.javaValueClassName!="BigDecimal")$>
takeStoredValueForKey(aValue, "<$attribute.name$>");
<$endif$>
}
The generated method looks like (just a sample, for scale = 4):
public void setQuantity(BigDecimal aValue) {
takeStoredValueForKey(aValue.setScale(4, BigDecimal.ROUND_HALF_UP), "quantity");
}
Peter
_______________________________________________
WebObjects-dev mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/webobjects-dev