Hello ,
I'm using Hibernate validator 5.1.3 , and when I want to validate a method , I cant get the parameter name ( but i have arg0 , arg1 , etc instead) to build the error validation messages. The problem is due to the fact that the method annotation must be on an interface , but the ParameterNameDiscover is trying to get the parameter name form the debug information (but there is no parameter name information in interface compiled class , only in the implementation ).
I've tried to move the validation annotation on the implementated class ( because the parameter name are in this compiled class) but I have an error from hibernate validator :
Quote:
A method overriding another method must not alter the parameter constraint configuration
here is my code (with annotation on interface) :
Interface : Code:
@Validated
public interface NomenclatureVenteRest {
public Response recupererArborescenceNomenclatureVente(
@FieldValidation(required="dateAppli") StimeDate dateAppli,
@FieldValidation(check = GENE_M010_PAYS) String codePays,
@FieldValidation(check = GENE_M010_ENSEIGNE) List<String> listeCodeEns) throws StimeFunctionalException;
}
Implementation : Code:
@Path("/")
@Service(value = "nomenclatureVenteRestImpl")
public class NomenclatureVenteRestImpl implements NomenclatureVenteRest {
@GET
@Path("/")
@Produces(RestUtils.UTF8_ENCODED_JSON)
@Override
public Response recupererArborescenceNomenclatureVente(
@QueryParam("dateAppli") StimeDate dateAppli,
@QueryParam("codePays")String codePays,
@QueryParam("listeCodeEns")List<String> listeCodeEns) throws StimeFunctionalException{
...Business logic...
}
}
Quote:
@FieldValidation is my custom constraint validation
If I put annotation validation on both interface and implementation , I don't have the error message about the overriding check rule , but the validation is applied on the interface , so I can't get the parameters names.
Please help me :-)
Regards ,
RĂ©gis LIMARE