[hibernate-issues] [Hibernate-JIRA] Created: (HV-252) HV with XML config tells me "Invalid property path." even though I know there is such a property.

Ed Burns (JIRA) noreply at atlassian.com
Tue Oct 13 14:52:41 EDT 2009


HV with XML config tells me "Invalid property path." even though I know there is such a property.
-------------------------------------------------------------------------------------------------

                 Key: HV-252
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-252
             Project: Hibernate Validator
          Issue Type: Bug
          Components: engine
    Affects Versions: 4.0.0.GA
         Environment: Java 6 on Mac OSX 10.5.8
            Reporter: Ed Burns
         Attachments: integration-test-servlet.war

I will attach a test war, but here is a summary of the problem.  I am configuring my BV with the following XML

<?xml version=\'1.0\' encoding=\'UTF-8\'?>
<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>integration_test_servlet</default-package>
      <bean class=\"Person\" ignore-annotations=\"true\">
          <field name=\"firstName\" ignore-annotations=\"true\">
              <constraint annotation=\"javax.validation.constraints.NotNull\" />
          </field>
          <field name=\"lastName\" ignore-annotations=\"true\">
              <constraint annotation=\"javax.validation.constraints.NotNull\" />
          </field>
          <getter name=\"listOfString\"  ignore-annotations=\"true\">
              <constraint annotation=\"javax.validation.constraints.NotNull\" />
          </getter>
      </bean>
</constraint-mappings>


My POJO looks like this:

package integration_test_servlet;

import java.util.List;
import javax.validation.constraints.NotNull;

public class Person {

    @NotNull
    private String firstName;


    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    @NotNull
    private String lastName;

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    private List<String> listOfString;

    @NotNull
    public List<String> getListOfString() {
        return listOfString;
    }

    public void setListOfString(List<String> listOfString) {
        this.listOfString = listOfString;
    }
    

}

And I'm trying to validate like this:

        List<String> listOfString = new ArrayList<String>();
        listOfString.add("one");
        listOfString.add("two");
        listOfString.add("three");

        Set<ConstraintViolation<Person>> violations =
                beanValidator.validateValue(Person.class, "listOfString", listOfString);

But this causes the following exception:

java.lang.IllegalArgumentException: Invalid property path. There is no property listOfString in entity integration_test_servlet.Person


The same test, but with no XML configuration, relying instead on the Annotations, works ok.



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