It's because you're validating your Controller as your root object and the DTO is being validated by the @Valid annotation.
Matt On Oct 17, 2013 10:12 AM, "Umesh Awasthi" <[email protected]> wrote: > Hi All, > > Testing a class level constraint, though it seems working fine but getting > issue while displaying errors to the user end.here is my constraints > declaration. > > Underlying validator is working as expected , but when i am trying to show > this to UI, it not working. > Since constraints defined is at class level like > > @FieldMatch.List({ > @FieldMatch(first="name",second="confirmName") > > }) > > so i was expecting that > violation.getPropertyPath().iterator().next().getName() will give me null, > but it is not giving me null. > > I have placed validation on Controller as > @Valid > private DonorProfileDTO donorProfileDTO; > // getter and setters > > and violation.getPropertyPath().iterator().next().getName() is giving me > value as > donorProfileDTO. > > I have pasted my validation code at Pastebin and here is link for same > Custom Validator Code <http://pastebin.com/vTg5FFdi> > > Not sure why it is not working as expected. > > -- > With Regards > Umesh Awasthi > http://www.travellingrants.com/ > > >
