Ok, you're right, an example is helpful here:
Classes Person and Driver. Consider the declaration of the field age is on the class Person!
Code:
public class Person {
private String name;
public int age;
// getters and setters ...
}
public class Driver extends Person{
private boolean hasDrivingLicense;
// getters and setters ...
}
Constraints for class Person.
Code:
constraints for super-class
<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
<bean class="Car" ignore-annotations="true">
<field name="name">
<constraint annotation="javax.validation.constraints.NotNull"/>
</field>
<field name="age">
<constraint annotation="javax.validation.constraints.Min">
<element name="value">1</element>
</constraint>
</field>
</bean>
</constraint-mappings>
Constraints for class Driver; These contraints should be an addition to the constraints of class Person!
Code:
<constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"
xmlns="http://jboss.org/xml/ns/javax/validation/mapping">
<bean class="Driver" ignore-annotations="true">
<field name="age">
<constraint annotation="javax.validation.constraints.Min">
<element name="value">18</element>
</constraint>
</field>
</bean>
</constraint-mappings>
I hope you get my problem now. Unfortunately i have no solution for this.
Daniel