title: Constraint Violation Property Path when using Sets
body: <p>I can't get my mind to wrap around a problem I have with a requirement concerning JSR303 bean validation (I'm currently using Hibernate Validator).</p>
  
  <p>Assuming I have the following domain model</p>
  
  <pre><code>class Foo {
     private Set&lt;Bar&gt; bars = new HashSet&lt;&gt;();
  
     @Valid
     public Set&lt;Bar&gt; getBars() { ... }
  }
  
  class Bar {
     private String name;
  
     @NotBlank
     public String getName() { ... }
  }
  </code></pre>
  
  <p>Say I have a <code>foo</code> instance with two <code>bar</code>s with one of the two names being empty.  After validating <code>foo</code> I'm holding a <code>@NotBlank</code> constraint violation with a property path <code>bars[].name</code> in my hand. Which is all well, but...</p>
  
  <p>is there any way I can find out which of the two bars had its name empty? Or am I forced to use a <code>List</code> here and introspect the - then unique - property path using reflection?</p>