title: DBUnit: dataset with MySQL YEAR type column
body: <p>folks!</p>
  
  <p>I'm having a problem using DBUnit:</p>
  
  <p>In my test class, when I call <strong>DatabaseOperation.INSERT.execute(connection, dataSet)</strong>, using a FlatXmlDataSet referencing a table that contains a column of type YEAR(4) - MySQL - I get the following:</p>
  
  <pre><code>(...)
  Caused by: org.dbunit.dataset.datatype.TypeCastException: Error casting value for table 'Vehicle' and column 'LaunchYear'
      at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:210)
      at net.carroramafleet.ws.utils.DbUnitHelper.execute(DbUnitHelper.java:57)
      ... 33 more
  Caused by: org.dbunit.dataset.datatype.TypeCastException: Unable to typecast value &lt;2010&gt; of type &lt;java.lang.String&gt; to DATE
      at org.dbunit.dataset.datatype.DateDataType.typeCast(DateDataType.java:110)
      at org.dbunit.dataset.datatype.DateDataType.setSqlValue(DateDataType.java:141)
      at org.dbunit.database.statement.SimplePreparedStatement.addValue(SimplePreparedStatement.java:73)
      at org.dbunit.database.statement.AutomaticPreparedBatchStatement.addValue(AutomaticPreparedBatchStatement.java:63)
      at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:200)
      ... 34 more
  </code></pre>
  
  <p>Here's my dataset:</p>
  
  <pre><code>&lt;dataset&gt;
      &lt;Vehicle 
              ID="999" 
              LaunchYear="2010" /&gt;
  &lt;/dataset&gt;
  </code></pre>
  
  <p>As I have mentioned above, I have a <strong>YEAR(4)</strong> type column, <strong>LaunchYear</strong>, in the table <strong>Vehicle</strong>. And DBUnit can't insert this row because of this information can't be converted correctly.</p>
  
  <p>I've already tried to <a href="https://merereflections.wordpress.com/2010/08/16/dbunit-and-setting-up-changing-data/" rel="nofollow">replace this information using DBUnit's ReplacementDataSet</a>, but I still have problem with TypeCastException. I really can't set a valid YEAR-formatted information.</p>
  
  <p>Could somebody help me?</p>
  
  <p>Thanks,</p>
  
  <p>Jeff</p>