title: Hibernate behavior with mysql strict mode
body: <p>My code was committing a bean using hibernate, in table 'mast' on UAT DB with  </p>
  
  <pre><code>session.save(userWalletConfigBean);
  transaction.commit()
  </code></pre>
  
  <p>It was working fine,
  however, in my production environment, it was throwing an error</p>
  
  <pre><code>Hibernate: insert into mast (wId, no, emailid, password, 
  name, usertype, userstatus, creationDate, aggreatorid, distributerid, 
  agentid, subagentid, createdby, loginStatus, lastlogintime, address1, 
  address2, city, state, pin, pan, adhar, kycstatus, approvalrequired, 
  agent, loginipiemi, loginagent, oldpassword, id) 
  values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
  2017-11-10/23:00:11.340  
  WARN: util.JDBCExceptionReporter - SQL Error: 1292, SQLState: 22001
  2017-11-10/23:00:11.341 
  ERROR: util.JDBCExceptionReporter - Data truncation: Truncated incorrect DOUBLE value: 'DIST001001'
  2017-11-10/23:00:11.342 
  ERROR: def.AbstractFlushingEventListener - Could not synchronize database state with session
  </code></pre>
  
  <p>Upon further inspection, I found out that this was due to Strict mode of SQL</p>
  
  <p>I took an insert query from UAT table and tried to directly run it on the Production database, this leads me to face the same <code>Truncated incorrect DOUBLE value</code> issue on production DB's logs.</p>
  
  <p>After which I disabled the strict mode of the production DB, and was able to directly run the insert query successfully.</p>
  
  <p>However, even after this, I am facing the same issue from my code when running on production.</p>
  
  <p>I have already double checked my tables on both UAT and production are same with no change.</p>
  
  <p>What I wish to know is how to solve this issue.</p>
  
  <p>Please let me know if anything else is required. </p>
  
  <p>Any help is appreciated. </p>
  
  <p>Below is my entity mapped bean</p>
  
  <pre><code>    @Entity
      @Table(name="mast")
      public class Mast implements Serializable{
  
          @Id
          @Column(name="id",length =30)
          private String id;
  
          @Column(name="wid",length =50,nullable = false,updatable=false)
          private String wId;
  
          @Column(name = "mobileno", unique = true, nullable = false, length = 12)
          private String mobileno;
  
          @Column(name = "emailid", unique = true, nullable = false, length = 100)
          private String emailid;
  
          @Column(name = "password", nullable = false, length = 100)
          private String password;
  
          @Column(name = "name", nullable = false, length = 100)
          private String name;
  
          @Column(name = "usertype", nullable = false, length = 2 ,columnDefinition = "int default 0")
          private int usertype;
  
          @Column(name = "userstatus", nullable = false, length = 2)
          private String userstatus;
  
          @Column(columnDefinition="TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
          private Date creationDate;
  
          @Column(name = "aggreatorid", nullable = true, length = 100)
          private String aggreatorid;
  
          @Column(name = "distributerid", nullable = true, length = 100)
          private String distributerid;
  
          @Column(name = "agentid", nullable = true, length = 100)
          private String agentid;
  
          @Column(name = "subagentid", nullable = true, length = 100)
          private String subAgentId;
  
          @Column(name = "createdby", nullable = true, length = 100)
          private String createdby;
  
          @Column(name = "loginStatus", nullable = false, length = 2 ,columnDefinition = "int default 0")
          private int loginStatus;
  
          @Column(columnDefinition="TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
          private Date lastlogintime;
  
          @Column(name="address1",length =50,nullable = true)
          private String address1;
  
          @Column(name="address2",length =50,nullable = true)
          private String address2;
  
          @Column(name="city",length =50,nullable = true)
          private String city;
  
          @Column(name="state",length =50,nullable = true)
          private String state;
  
          @Column(name="pin",length =50,nullable = true)
          private String pin;
  
          @Column(name="pan",length =20,nullable = true)
          private String pan;
  
          @Column(name="adhar",length =20,nullable = true)
          private String adhar;
  
          @Column(name="kycstatus",length =20,nullable = true)
          private String kycstatus;
  
          @Column(name = "approvalrequired", nullable = true, length = 2)
          private String approvalRequired;
  
          @Column(name = "agent",  length = 300 )
          private String agent;
  
          @Column(name = "loginipiemi",  length = 20 )
          private String loginipiemi;
  
          @Column(name = "loginagent",  length = 300 )
          private String loginagent;
  
          @Column(name = "oldpassword",  length = 1000 )
          private String oldPassword;
  
  
      }
  </code></pre>
  
  <p>Below is my DB schema</p>
  
  <pre><code>    CREATE TABLE mast (
          id VARCHAR(30) NOT NULL,
          wid VARCHAR(50) NOT NULL,
          mobileno VARCHAR(12) NOT NULL,
          emailid VARCHAR(100) NOT NULL,
          password VARCHAR(100) NOT NULL,
          name VARCHAR(100) NOT NULL,
          usertype INT(11) NOT NULL DEFAULT '0',
          userstatus VARCHAR(2) NOT NULL,
          creationDate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
          aggreatorid VARCHAR(100) NULL DEFAULT NULL,
          distributerid VARCHAR(100) NULL DEFAULT NULL,
          agentid VARCHAR(100) NULL DEFAULT NULL,
          subagentid VARCHAR(30) NULL DEFAULT NULL,
          createdby VARCHAR(100) NULL DEFAULT NULL,
          loginStatus INT(11) NOT NULL DEFAULT '0',
          lastlogintime TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
          address1 VARCHAR(50) NULL DEFAULT NULL,
          address2 VARCHAR(50) NULL DEFAULT NULL,
          city VARCHAR(50) NULL DEFAULT NULL,
          state VARCHAR(50) NULL DEFAULT NULL,
          pin VARCHAR(50) NULL DEFAULT NULL,
          pan VARCHAR(20) NULL DEFAULT NULL,
          adhar VARCHAR(20) NULL DEFAULT NULL,
          kycstatus VARCHAR(20) NULL DEFAULT NULL,
          approvalrequired VARCHAR(2) NULL DEFAULT NULL,
          prepaidcardnumber VARCHAR(20) NULL DEFAULT NULL,
          agent TEXT NULL,
          loginipiemi VARCHAR(20) NULL DEFAULT NULL,
          loginagent TEXT NULL,
          oldpassword TEXT NULL,
          PRIMARY KEY (id)
      )COLLATE='utf8_general_ci'
  ENGINE=InnoDB;
  </code></pre>