title: Difference between @Size, @Length and @Column(length=value) when using JPA and Hibernate
body: <p>What is the difference between the validation check of the following three fields?</p>
  
  <pre><code>@Entity
  public class MyEntity {
  
      @Column(name = "MY_FIELD_1", length=13)
      private String myField1;
      @Column(name = "MY_FIELD_2")
      @Size(min = 13, max = 13)
      private String myField2;
      @Column(name = "MY_FIELD_3")
      @Length(min = 13, max = 13)
      private String myField3;
  
      // getter &amp; setter
  
  }
  </code></pre>
  
  <p>I read that the first one has to do with DDL stuff.
  The second is for bean-validation.
  The third is for hibernate-validation.</p>
  
  <p>Is that correct? What I still don't understand is: When do I have to use which one? When does one of these annotations trigger?</p>
  
  <p>Edit: Think of the following situation:
  Given the requirement to develope an entity with a field of type string with length 13. Which of above mentioned methods would you choose? Or even better: Which questions do you have to ask yourself to find out which one suits your purposes?</p>