Yes it is, consider:
public class Parent {
@NotNull
private String parentString = null;
@NotNull
@Valid
private Child child = null;
/*
GETTER AND SETTER METHODS GO HERE
*/
}
public class Child {
@NotEmpty
@NotNull
private String childString = null;
@NotNull
private Parent = null;
/*
GETTER AND SETTER METHODS GO HERE
*/
}
(Not that this example would require proper getter methods and some
set values)
In this case the @Valid annotation causes the validator to Validate
the child class according to the rules of that child class. The
@NotNull validation is performed first howerver /and/ it should be
noted that the @Valid annotation will not be processed on null objects
in any case. The validators also contain logic to prevent cyclic
reprocessing, for example if you set the bidirectional Parent<->Child
relationship as is possible in the example Parent /will not/ be
processed twice and therefore neither will Child. The protection
isn't perfect but it should be enough for the needs of most people.
Let me know if you have any more questions.