1
I have a Java SE application where I can’t use the @size annotation. This annotation is worked out by the org.hibernate.Validator.Size.
There is a user field in the model where I do so:
@Size(min = 1, max = 30)
@Column(name = "CAMPO")
private String campo;
When trying to save an object it accuses an Invalidstateexception, saying that the value of the String field, which received the value "3216549", should be between 1 and 30 in size. But the value should go through validation.
I tried using @length and did not accuse this error anymore. Does anyone have any idea what might be going on with @size? I read in some places that it is more recommended than @length, for compatibility reasons and wanted to use it.
I’m using String, so the two would have to work the same way. But Size says the value is invalid (which is wrong) and Length is working correctly. I didn’t understand.
– Cleber Farinazzo Junior