Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8048473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:27:01+00:00 2026-06-05T06:27:01+00:00

Using version Hibernate Validator 4.3.0.Final. When I make the following call: Set<ConstraintViolation<T>> violations =

  • 0

Using version Hibernate Validator 4.3.0.Final.

When I make the following call:

Set<ConstraintViolation<T>> violations = validator.validateProperty(objectForValidation, "list[0].field1", groups);

on an instance of ClassForValidation populated with one instance of ChildClassForValidation with field1 = “”

    public class ClassForValidation {

        @NotEmpty
        private String fielda;

        @Valid
        private List<ChildClassForValidation> list = new ArrayList<ChildClassForValidation>();

        public ClassForValidation(List<> list, String fielda) {
                this.list = list;
                this.fielda = fielda;
        }
    }

    public class ChildClassForValidation {
        @NotEmpty
        private String field1;

        public ChildClassForValidation(String field1) {
                this.field1 = field1;
        }
    }

I get the follwing exception:

java.lang.IllegalArgumentException: HV000039: Invalid property path. There is no property field1 in entity java.util.ArrayList.
at org.hibernate.validator.internal.engine.ValidatorImpl.collectMetaConstraintsForPath(ValidatorImpl.java:1141)
at org.hibernate.validator.internal.engine.ValidatorImpl.collectMetaConstraintsForPath(ValidatorImpl.java:1179)
at org.hibernate.validator.internal.engine.ValidatorImpl.validatePropertyInContext(ValidatorImpl.java:616)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateProperty(ValidatorImpl.java:151)
...

After looking into the Hibernate Validator source I have come to the conclusion that this is a bug. For in the source there appears to be code attempting to handle both lists and maps. I believe the error lies in the following piece of code in org.hibernate.validator.internal.engine.ValidatorImpl

    private <T, U, V> ValueContext<U, V> collectMetaConstraintsForPath(Class<T> clazz, Object value, Iterator<Path.Node> propertyIter, PathImpl propertyPath, List<MetaConstraint<?>> metaConstraintsList) {
            Path.Node elem = propertyIter.next();
            Object newValue = value;

            BeanMetaData<?> metaData = beanMetaDataManager.getBeanMetaData( clazz );
            //use precomputed method list as ReflectionHelper#containsMember is slow
            if ( !metaData.isPropertyPresent( elem.getName() ) ) {
                throw log.getInvalidPropertyPathException( elem.getName(), metaData.getBeanClass().getName() );
            }
            ...
    }

In this piece of code it verifies that clazz has the property being validated, the problem is that when processing field1, clazz is ArrayList instead of the item(0)’s class (i.e. ChildClassForValidation).

I would like to confirm my findings before submitting a bug to the Hibernate Validator project. Who knows I might just have the wrong syntax for my property path.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:27:03+00:00Added an answer on June 5, 2026 at 6:27 am

    As of Bean Validation 1.0, Validator#validateProperty() supports only the validation of single properties, but not complete property paths. As discussed on the BV mailing list, such a feature might be supported in future revisions of the spec.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using version 3.6.1.Final I have the following property in my entity bean @JoinColumn(
after i updated to hibernate-validator 4.2.0.Final <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>4.2.0.Final</version> <scope>runtime</scope> </dependency> when trying
We are using Ehcache version 2.4.4 with Hibernate 3.5.5-FINAL. I've got a strange case
I'm using Hibernate 3.5.5.Final and JPA2 How can make a testcase to test if
I have set up a NInject (using version 1.5) binding like this: Bind<ISessionFactory>().ToMethod<ISessionFactory>(ctx =>
I have problem with using Hibernate Validator with GWT 2.4. When module is starting
In my Maven pom.xml I have the following dependencies: <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.3.2.GA</version> </dependency>
I'm using Hibernate Validator in an application with EJB and Spring MVC. I'm using
I have a question about Hibernate. I'm using 3.1.3 version and I have two
I am using hibernate-search-3.2.1.Final and would like to parse my input into shingles. From

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.