Hi,
There have been already quite some topics about this, except how to use this in XML. (Please don't start the why XML discussion here :-) )
Code:
<bean class="com.SubObject">
<field name="superField">
<constraint annotation="org.hibernate.validator.constraints.NotBlank">
<message>Should not be empty</message>
<groups>
<value>com.SomeGroup</value>
</groups>
</constraint>
</field>
</bean>
Code:
public class SubObject extends SuperObject{
public SubObject() {
super();
}
private String someSubField;
.. getters setters etc
}
public class SuperObject {
public SuperObject() {
super();
}
private String superField;
.. getters setters etc
}
Now the error:
javax.validation.ValidationException: com.SubObject does not contain the fieldType superField