0

I have complex model request class and I am using valid annotation. But it doesnt work in subclasses.

cause=java.lang.NullPointerException detailMessage=HV000028: Unexpected exception during isValid call.

public class ChangeBlackListStatusRequest {

    @Valid
    List<CategoryChangeRequest> categoryChangeRequestList;
}

public class CategoryChangeRequest {

    @Valid
    List<Category> categoryList;

    @Valid
    List<Service> serviceList;

    @Valid
    List<Merchant> merchantList;

    @Valid
    List<Aggregator> aggregatorList;

}
Vishwa Ratna
  • 5,567
  • 5
  • 33
  • 55
  • 1
    ` @Valid ` is very handy for so called validation cascading when you want to validate a complex graph and not just a top-level elements of an object. Every time you want to go deeper, you have to use` @Valid ` – Vishwa Ratna Jan 07 '19 at 08:56
  • [@Valid is a JSR-303 annotation and JSR-303 applies to validation on JavaBeans](https://stackoverflow.com/questions/17207766/spring-mvc-valid-on-list-of-beans-in-rest-service) only. – dbl Jan 07 '19 at 09:09
  • it doesnt work. I want to check parameters of Category class. – Utkan Asan Jan 07 '19 at 11:01

0 Answers0