I tried using an
integer, but the problem is the same. The errormessage I got was the one from
javax.faces.converter.IntegerConverter.INTEGER_detail instead of
javax.faces.converter.ByteConverter.BYTE_detail - just a larger range of numbers.
I also tried your UserType advice, but I couldn't make it work (probably a combination of bad web-researching- and programming-skills).
However, I found a way to use
byte for a datatype, but also to get the error message behavior I was looking for:
Code:
@Range(max=99, min=0)
private Byte brothers;
public String getBrothers() {
if(brothers==null){
return "";
}else {
return "" + brothers;
}
}
public void setBrothers(String brothers) {
this.brothers = Byte.valueOf(brothers);
}
As you can see, the property is defined as
Byte, but I use
String in my Get- and Set-methods. It sure is, again, a questionable moddeling style. But at least the property should have byte's memory usage - right?!