title: How to silently truncate strings while storing them when they are longer than the column length definition?
body: <p>I have  a web app, using EclipseLink and MySQL for storing data.
  Some of these data are strings, ie varchars in the DB.
  In the code of entities, the strings have attributes like this:</p>
  
  <pre><code>@Column(name = "MODEL", nullable = true, length = 256)
  private String model;
  </code></pre>
  
  <p>The database is not created by eclipseLink from the code, but the length matches the varchar length in the DB.
  When the length of such a string data is greater than the length attribute, an exception is raised during the call to javax.persistence.EntityTransaction.commit():</p>
  
  <pre><code>javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.DatabaseException
  Internal Exception: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'MODEL' at row 1
  </code></pre>
  
  <p>Then the transaction is rolled back.
  While I understand that it is the default behaviour, this is not the one I want.
  I would like the data to be silently truncated, and the transaction to be committed.</p>
  
  <p>Can I do this without adding a call to substring to each and every set method of string data for the concerned entities?</p>