title: While inserting String value (java) in Enum field (DB) Getting " Data truncated for column"
body: <p>In my mysql table there is one enum field 'spe_gender'. </p>
  
  <pre><code>mysql&gt; desc tbl_sswltdata_persons;
  +-----------------+-----------------------+------+-----+---------+----------------+
  | Field           | Type                  | Null | Key | Default | Extra          |
  +-----------------+-----------------------+------+-----+---------+----------------+
  | spe_id          | bigint(20) unsigned   | NO   | PRI | NULL    | auto_increment |
  | spe_sen_id      | bigint(20) unsigned   | NO   | MUL | NULL    |                |
  | spe_gender      | enum('male','female') | YES  |     | NULL    |                |
  | spe_is_deceased | tinyint(1)            | NO   |     | 0       |                |
  | spe_birth_place | varchar(255)          | YES  |     | NULL    |                |
  | spe_create_date | datetime              | YES  |     | NULL    |                |
  | spe_update_date | datetime              | YES  |     | NULL    |                |
  +-----------------+-----------------------+------+-----+---------+----------------+
  7 rows in set (0.00 sec)
  </code></pre>
  
  <p>So I created one POJO class as:</p>
  
  <pre><code>public class SswltdataPersons implements Serializable {
      private static final long serialVersionUID = 1L;
  
      private long spe_id;
      private long spe_sen_id;
      private String spe_gender;
      private String spe_is_deceased;
      private String spe_birth_place;
      private String spe_create_date;
      private String spe_update_date;
  
      // .........
  
      public String getSpe_gender() {
          return spe_gender;
      }
      public void setSpe_gender(String spe_gender) {
          this.spe_gender = spe_gender;
      }
  
      // ......
  
  }
  </code></pre>
  
  <p>When I trying to write data into this table I am getting an exception </p>
  
  <pre><code>org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL 
      [INSERT INTO iwpro_imp.tbl_sswltdata_persons VALUES(?,?,?,?,?,?,?)]; 
      Data truncated for column 'spe_gender' at row 1; nested exception is java.sql.BatchUpdateException: Data truncated for column 'spe_gender' at row 1
  </code></pre>
  
  <p>I think the issue is While inserting String value (through java) in Enum field (in DB). Here is my methods where I am getting Exception. </p>
  
  <pre><code>@Transactional(value="transactionManager_iwpro_imp", rollbackFor = Exception.class)
      public void saveAllPersons(final List&lt;SswltdataPersons&gt; list) {
  
  
          String sql = "INSERT INTO iwpro_imp.tbl_sswltdata_persons VALUES(?,?,?,?,?,?,?)";
  
          try{
              jdbcTemplate.update("SET foreign_key_checks = 0");
  
              List&lt;List&lt;SswltdataPersons&gt;&gt; batchLists = Lists.partition(list, batchSize);
  
              for(final List&lt;SswltdataPersons&gt; batch : batchLists) {
                  BatchPreparedStatementSetter bpss = new BatchPreparedStatementSetter() {
                      @Override
                      public void setValues(PreparedStatement ps, int index) throws SQLException {
                          SswltdataPersons dataObject = batch.get(index);
                          ps.setLong(1, dataObject.getSpe_id());
                          ps.setLong(2, dataObject.getSpe_sen_id());
                          ps.setString(3, dataObject.getSpe_gender());
                          ps.setString(4, dataObject.getSpe_is_deceased());
                          ps.setString(5, dataObject.getSpe_birth_place());
                          ps.setString(6, dataObject.getSpe_create_date());
                          ps.setString(7, dataObject.getSpe_update_date());
                      }
  
                      @Override
                      public int getBatchSize() {
                          return batch.size();
                      }
                  };
                  jdbcTemplate.batchUpdate(sql, bpss);
              }
  
              jdbcTemplate.update("SET foreign_key_checks = 1");
  
          }catch(Exception e){
              TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
              logger.error("\n\nUnexpected Exception:\n", e);
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>Can't I insert this enum value in DB?</p>