userimage
Ray

HV000030: No validator could be found for type: java.math.BigDecimal

I have a field: Ordinality DB: ORDINALITY NOT NULL NUMBER(2)

@Column(name="ORDINALITY") @NotNull(message="Ordinality is Mandatory") @Size(max=2,message="Ordinality exceeded the limit, Max. 2 numbers are allowed.") private BigDecimal ordinality;
  1. I want to restrict the entry to numbers only, what will be the exact annotation syntax.
  2. I am getting below error, when I am giving proper value as well as not giving any value and submit page.
javax.validation.UnexpectedTypeException: HV000030: No validator could be found for type: java.math.BigDecimal.     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorManager.verifyResolveWasUnique(ConstraintValidatorManager.java:218)     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorManager.findMatchingValidatorClass(ConstraintValidatorManager.java:193)     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorManager.getInitializedValidator(ConstraintValidatorManager.java:97)     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:125)     at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:91)     at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:83)     at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:547)
userimage
To set precision of the underlying database field, you should use the precision and the scale elements of the @Column annotation.
@Column(precision=10, scale=2)

To validate the number use the @DecimalMax annotation.

@DecimalMax("30.00")
Answer is