Home > Back-end >  No validator could be found for constraint 'jakarta.validation.constraints.Pattern' valida
No validator could be found for constraint 'jakarta.validation.constraints.Pattern' valida

Time:01-10

We have written liquibase changelog to generate tables and using spring data hibernate support to map with entities.

But when I try to insert User with json payload. I am getting following exception.

*jakarta.validation.UnexpectedTypeException: HV000030: No validator could be found for constraint 'jakarta.validation.constraints.Pattern' validating type 'java.time.LocalDate'. Check configuration for 'birthdate' at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.getExceptionForNullValidator(ConstraintTree.java:116) Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: *.

My change log. <column name="birthdate" type="date 'yyyy-MM-dd'"> <constraints nullable="false"/> </column>

Hibernate Mapping is.

`@Column(name = "birthdate", nullable = false)
private LocalDate birthdate;`

What is this issue and how to resolve it?

I try to do a api call to save this user. In that point I am getting above exception.

CodePudding user response:

I fixed this issue by reverting in to API.yml by removing pattern from this.

    birthdate:
      type: string
      description: The date of birth in Cognito.
      format: date
      example: '1970-07-18'
  • Related