title: How to increase length of a String in mysql while mapping using JPA
body: <p>I'm having some trouble in JPA. I would be really thankful if someone could provide a solution. WIth JPA (I'm using MySQL DB), lets say, I have a class mapped as follows: </p>
  
  <pre><code>@Entity    
  class Employee{    
     int id;    
     String employeeName;    
   //getters and setters...   
   }
  </code></pre>
  
  <p>when mapping to the table, I see that String is mapped with <code>varchar(255)</code> in Mysql. However, lets say if I have an employee whose name is more than 255 chars, it shows data truncation error. </p>
  
  <p>I know we could solve this by adding <strong>"length"</strong> attribute to the Employee column as:</p>
  
  <pre><code>@column(length=1000)    
  String employeeName;
  </code></pre>
  
  <p>Is this the only possible way? I thought, if we just map to String in java, the database would dynamically assign length. </p>