title: Spring Validation - BindingResult
body: <p>I am trying to understand what <code>BeanPropertyBindingResult</code> does in the following code. Unfortunately, the <a href="http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/validation/BeanPropertyBindingResult.html#BeanPropertyBindingResult%28java.lang.Object,%20java.lang.String%29" rel="noreferrer">javadoc</a> is quite useless.</p>
  
  <p>Please take a look at the following code:</p>
  
  <pre><code>BeanPropertyBindingResult errors = new BeanPropertyBindingResult(item, "item");
  validator.validate(item, errors);
  </code></pre>
  
  <p>My questions are:</p>
  
  <ol>
  <li><p>As far as I can see, <code>BeanPropertyBindingResult</code> is basically some kind of a <code>Map</code> that can contain key/value pairs of (field name, error text). Is this correct, or is the truth more complicated?</p></li>
  <li><p>When I create a new <code>BeanPropertyBindingResult</code>, why do I need to provide it (as the constructor's first parameter) with the object I am going to validate? As far as I can see, in the second line above, <code>validator.validate(item, errors);</code> the validator gets the object anyway.. so why doing it twice?</p></li>
  <li><p>The javadoc says about the constructor's second parameter:</p></li>
  </ol>
  
  <blockquote>
    <p>objectName - the name of the target object</p>
  </blockquote>
  
  <p>yes, but why do I need that name? What am I supposed/able to do with it...?</p>