Search code examples
hibernatespring-data-jpaliquibase

No validator could be found for constraint 'jakarta.validation.constraints.Pattern' validating type 'java.time.LocalDate'


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.


Solution

  • 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'