posted 12 years ago
When I extract a inserted record(apache Derby embeded db) to view it I load a DECIMAL datatype of 100.00 from the database to the controller variable payRate with data type BigDecimal.
The database loads a BIGDECIMAL from this controller just fine. but the data type is noted as DECIMAL(5,2) in the table createion. Is there a code example other than the API that could explain how to store 100.00 (DECIMAL from the database) to a data Type
BIGDECIMAL In the controller. Does a scale have to be established or some kind of rounding of the
value coming from database have to happen? I can not understand the rounding or mathContext() descriptions in Class BigDecimal or Enum Rounding Class.
I can not understan why the data types are compatable on insert but if I pull the value out
It will not load the same vaiable.
Before the insert the bean contains: Data type= BigDecimal
The bean value is inserted into the table of data type:
result output :inserted into database (apache derby embedded)
when I then select the record back out to look at it:
When I extract the same record to view it I load a controller
my application at this early stage will not deal with any complex math.everything is rounded
to two decimal places ex(25.00)
I probably should change the data types to BIGINT (apache derby)
is there a way to continue with BIGDECIMAL? Would there be any advantage later if the math gets more complex? Or would BIGINT handle the basics?