[hibernate-issues] [Hibernate-JIRA] Resolved: (HV-214) Constraints from interfaces and superclasses are not inherited when XML descriptors are used
Hardy Ferentschik (JIRA)
noreply at atlassian.com
Wed Aug 26 10:58:16 EDT 2009
[ http://opensource.atlassian.com/projects/hibernate/browse/HV-214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hardy Ferentschik resolved HV-214.
----------------------------------
Resolution: Fixed
> Constraints from interfaces and superclasses are not inherited when XML descriptors are used
> --------------------------------------------------------------------------------------------
>
> Key: HV-214
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-214
> Project: Hibernate Validator
> Issue Type: Bug
> Components: engine
> Affects Versions: 4.0.0.Beta3
> Reporter: Igor Drobiazko
> Assignee: Hardy Ferentschik
> Fix For: 4.0.0.CR1
>
> Attachments: test.zip
>
>
> When using XML descriptors the contraints from interfaces and superclasses are not inherited. Let's have a look at following example.
> public interface Person {
> String getFirstName();
> String getMiddleName();
> String getLastName();
> }
> public class Customer implements Person {
> private String firstName;
> private String middleName;
> private String lastName;
> private String customerId;
> private String password;
> ...
> }
> <constraint-mappings
> xmlns="http://jboss.org/xml/ns/javax/validation/mapping"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation=
> "http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd">
>
> <default-package>com.acme</default-package>
>
> <bean class="Person" ignore-annotations="false">
> <getter name="firstName">
> <constraint annotation="javax.validation.constraints.NotNull"/>
> </getter>
> </bean>
>
> <bean class="Customer" ignore-annotations="false">
> <field name="lastName">
> <constraint annotation="javax.validation.constraints.NotNull"/>
> </field>
> </bean>
> </constraint-mappings>
> The constraint @NotNull for the property firstName is not considered. A Customer without a firstName would pass the validation successfuly.
> Accoring to annotations it should be possible to define contraints for superclasses and interfaces which will be inherited.
> A testcase is attached.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list