I have an entity class for which one of the fields is set up as an enum:
Code:
@Enumerated( EnumType.STRING )
@Column( name = "seeded_flag" )
private BaseYesNo seededFlag;
The enum is as follows:
Code:
public enum BaseYesNo {
Y( "Y" ),
N( "N" );
private String yesNoVal;
private static Map< String, BaseYesNo > stringToEnum = new HashMap< String, BaseYesNo >();
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 );
}
}
The problem is that I am getting the following exception:
Code:
javax.validation.UnexpectedTypeException: No validator could be found for type: base.model.schema.BaseYesNo
Any clue why I am getting this exception? I have also tried defining a custom validator to handle BaseYesNo, but it didn't make a difference.
Thanks in advance!,
Kurz