我有一个字段: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;
- 我只想将条目限制为数字,确切的注释语法是什么。
- 当我给出适当的值以及不给出任何值并提交页面时,我遇到了错误。
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)