java - How to validate a property of a component entity via hibernate? -
i have following class:
class foo { @valid private bar bar; } in bar, have:
class bar { @notempty private string baz; } i want validate property bar.baz foo. when try validateproperty() , pass string bar.baz property name, error there's no such property. not possible validate child properties in way?
as per bean validation specification property must direct property of bean validating:
set> validateproperty(t object, string propertyname, class... groups) validates given field or property of object. illegalargumentexception thrown when validateproperty() called , object null or propertyname null empty or invalid or null passed varargs groups parameter. property name javabeans property name (as defined javabeans introspector class). method implements logic described in section 4.6, “validation routine” given property. @valid not honored method. method useful partial object validation.
that said, hibernate validator supports property paths can see here. further, need post full stack trace.
Comments
Post a Comment