title: JPA - No validator could be found for type: enum
body: <p>I have an entity class which uses an enum type for one of the properties, and I am getting the following exception when I try to persist the entity:</p>
  
  <pre><code>javax.validation.UnexpectedTypeException: No validator could be found for type: model.schema.BaseYesNo
  </code></pre>
  
  <p>Any idea why this might be happening? My thinking is that since it is an enum, it should already be validated by the compiler, so no need for some kind of validator. (code below)</p>
  
  <p>The entity property:</p>
  
  <pre><code>@Enumerated( EnumType.STRING )
  @Column( name = "seeded_flag" )
  private BaseYesNo seededFlag;
  
  public BaseYesNo getSeededFlag() {
      return this.seededFlag;
  }
  
  public void setSeededFlag( BaseYesNo seededFlag ) {
      this.seededFlag = seededFlag;
  }
  </code></pre>
  
  <p>And the definition of the enum type:</p>
  
  <pre><code>public enum BaseYesNo {
      YES( "Y" ),
      NO( "N" );
  
      private String yesNoVal;
  
      private static Map&lt; String, BaseYesNo &gt; stringToEnum = new HashMap&lt; String, BaseYesNo &gt;();
  
      static {
              for ( BaseYesNo byn : BaseYesNo.values() ) {
              BaseYesNo.stringToEnum.put( byn.toString(), byn );
          }
      }
  
      BaseYesNo( String yesNoVal ) {
          this.yesNoVal = yesNoVal;
      }
  
      public static BaseYesNo fromString( String dbValue ) {
          return BaseYesNo.stringToEnum.get( dbValue );
      }
  
      @Override
      public String toString() {
          return this.yesNoVal;
      }
  }
  </code></pre>