"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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.