"HV000030: No validator could be found for type" for string mapped enumeration in Hibernate

Solution Verified - Updated -

Issue

javax.validation.UnexpectedTypeException: HV000030: No validator could be found for type my.types.Day.
  • An entity has an enum property which is mapped with @Enumerated(EnumType.STRING)
public enum Day {
    SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY 
}

import javax.persistence.Enumerated;
import javax.persistence.EnumType;

@Entity
public class Week ... {
    @Enumerated(EnumType.STRING)
    ...
    private Day day;
}
  • Using JSR 303 bean validation constraints with the enum entity property
    • Using @Length
    • Using a custom implementation of javax.validation.ConstraintValidator

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP) 6
  • Hibernate 4
  • JSR 303 Bean Validation 1.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content