java - 10-digits BigDecimal cannot be saved in NUMBER(10, 2) column -
in oracle 12 database, 1 of column defined number(10,2). goal store numbers one: 12345678.12. actually, can store such number thank oracle sql developer, format matching.
through hibernate-java app, when update entity containing following values, works:
1.12 12.12 123.12 1234.12 12345.12 123456.12 but following, error
1234567.12 12345678.12 ora-01438: value larger specified precision allowed column it looks number(8, 2)...
the field in @embeddable class, type bigdecimal, without field annotation:
@entity @table(...) public class classa implements serializable { @embedded private classb bobject; } @embeddable public class classb implements serializable { @embedded private classc cobject; } @embeddable public class classc implements serializable { private bigdecimal myfield; } is there other things can override column definition?
the first number in decimal type precision, second digit scale.
oracle's documentation:
you can specify precision (the total number of digits, both left , right of decimal point) , scale (the number of digits of fractional component).
if have 10 digits before fraction, need decimal(12,2).
the error see comes oracle, not hibernate, doubt changing entity configuration solve issue.
Comments
Post a Comment