0

Hi I am trying to validate integer and precision part for one column. Its not validating at all against Bigdecimal value. My Database is Oracle. Its validating if i am changing the data type to String .

@Column(name = "L_MI_COVERAGE_PERCENT")
@Digits(integer=3, fraction=6, message = "MI Coverage Percent should be precision 9 and scale 6.")
private BigDecimal  miCoveragePercent;

My database Column is

L_MI_COVERAGE_PERCENT   NUMBER(9,6)

I am passing a value like this 100001.10 . When i am running the application i am getting error as

org.hibernate.exception.DataException: could not execute statement .

  ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
                Validator validator = factory.getValidator();
                Set<ConstraintViolation<Loans>> violations = 
  validator.validate(loans); 

I am not getting any violations , but other fields validations are happening and messages are coming back in violations object except miCoveragePercent. This is the only with Bigdecimal.

VKP
  • 589
  • 1
  • 8
  • 34
  • You write "Its not validating at all". Could you please post an example an input you would expect to be validated, what would would expect to happen and what actually is hapening. – Kaj Hejer Apr 03 '21 at 10:07
  • Updated the Question with some details. – VKP Apr 03 '21 at 10:20

0 Answers0