Here is what i want to be able to do with bean validation in my JPA entities :
- Instead of
@NotNull, i would like to do@NotNull(message="keyInMyResourceBundleFile") - I would like also to parameterize the resourceBundle, and i dont know the syntax for it, because it seems to me the message attribute contains only a string.
- The parameter itself could be i18n-ed. For example, assuming there's a param attribute for the resourcebundle parameters, in English,
@NotNull(message="missing.value", params={"credit card"}) String creditCard;It will be displayed something like this : "Missing required value for field credit card. In Indonesia, it'll be something like "Nilai harus di isi untuk Kartu Kredit. In this example, i cant hardcode the "credit card" because in Indonesia, it's "Kartu Kredit" - Displays the error message defined in the resource bundle on the log file or UI. Im not sure the way on how to do it, should i catch the
ConstraintViolationException, get the message, and process the resource bundle by my own code ?
Please share your thoughts on this ?
Thank you !