I need to know the equivalent of @size annotation used in hibernate model classes, which we can use in the hbm.xml file.
Little background : So I ran into this problem where a column size is specified as 255 in the database and I have restricted the characters in corresponding input box to 255 using the maxLength attribute of the textArea html tag. User is not able to enter more than 255 characters. But, when you enter certain gibberish text in the text box which contains 255 charcters only, the code breaks at the time of saving it. Logs say that we are trying to enter 256 characters! Example text entered :
lkjsajf,asdmcladskfhncv,sd.mcvjhsdlk;j;lsdnc;;sadkjlfhsdnvcjsdhfvdsnkcjlsdjlfcujdslknfjkds;hgdsjnfajijujjfkvlfdsvil;djsvmjds;ocujas;mcklsdavhodsalvnlsdka;hvdslnvc;lsidhvydsknvlioadsiugvpodsjv;sdaou'gvdpsovjl;cs;llhavfaskgjvlkds'jvc'dsajouopds 'fjdls;jvcl;
To fix this, I added @size annotation on the corresponding column of model, which is used by hibernate bean validation and prevents exception being thrown on the page and shows the validation message instead. My project has mixture of hbm mapping files and just the model classes with hibernate annotations. I need to know what to use in the hbm file to show the same validation message.