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?
Well, regardless of all that, there's a good chance that "rs.getBigDecimal(12)" is just attempting to get data from some other field because you miscounted your columns. However you didn't post the query so it's impossible for anybody but you to confirm that.
I Looked at it fresh this morning and clearly the SELECT statement (above) indeed it is
trying to load rs.getBigDecimal(12) by accessing the admin_area_code field. So I will
stick with BIGDECIMAL. I am not certain but in my limited understanding of the math concepts
of BIGINT and BIGDECIMAL and the math I may inject into the App. I am under the impression
that BIGDECIMAL will handle a wider variety of mathematical calculations.
Thanks for your time.