[hibernate-issues] [Hibernate-JIRA] Created: (HV-262) Using interface in xml configuration does not work

Michenaud Laurent (JIRA) noreply at atlassian.com
Wed Oct 28 05:14:13 EDT 2009


Using interface in xml configuration does not work
--------------------------------------------------

                 Key: HV-262
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-262
             Project: Hibernate Validator
          Issue Type: Bug
          Components: mapping
    Affects Versions: 4.0.0.GA
         Environment: Linux Ubuntu, Hibernate Validator 4.0.0.GA
            Reporter: Michenaud Laurent


I want to use xml configuration to define the constraints
but it doesnot seem to work when i use interface. It works
when i use the implementation instead. When i say it doesnot work, it means
there is no error at loading the mapping but the validator validates
nothing.

This below configuration doesnot work. IMyClass is an interface.

<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">
	<default-package>org.mypackage</default-package>
	<bean class="IMyClass" ignore-annotations="true">	
		<getter name="id" ignore-annotations="true">
			<constraint annotation="javax.validation.constraints.NotNull"/>
		</getter>
	</bean>
</constraint-mappings>

With this configuration, it works. MyClassImpl is a class that implements IMyClass.

<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">
	<default-package>org.mypackage</default-package>
	<bean class="MyClassImpl" ignore-annotations="true">	
		<getter name="id" ignore-annotations="true">
			<constraint annotation="javax.validation.constraints.NotNull"/>
		</getter>
	</bean>
</constraint-mappings>

-- 
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