title: Issue with JdbcTemplate BeanPropertyRowMapper - setting int & double field as 0 instead of actual value
body: <p>I am trying to fetch an record from a database using Spring Jdbctemplate.. In JdbcTemplate I am trying to automate data bind by making use of the class BeanPropertyRowMapper... My database table column name-type &amp; model object field name-type are same...I implemented this API but I am not getting expected results.. For int &amp; double fields I am getting 0 &amp; 0.0 value even though these are different values in database...</p>
  
  <p>Please help to solve this problem... My code is like below,</p>
  
  <pre><code>@Override
  public DiscountDetail getDiscountDetailById(int ID) throws ServiceException 
  {
      String sql = "SELECT * FROM TBL_DISCOUNT where Id="+ID;
      logger.info("sql :"+sql);
      List&lt;DiscountDetail&gt; discounts  = jdbcTemplate.query(sql, new BeanPropertyRowMapper(DiscountDetail.class));
  
      if (discounts.size() == 1) {
          logger.info("discount :"+discounts.get(0).toString());
          return discounts.get(0);
      }   
      return null;
  } 
  </code></pre>
  
  <p>DescountDetail.java</p>
  
  <p>public class DiscountDetail extends GenericEntity{</p>
  
  <pre><code>private int discountId,higherLimit,lowerLimit;
  private double discountPercentage;
  
  public int getDiscountId() {
      return discountId;
  }
  
  public void setDiscountId(int discountId) {
      this.discountId = discountId;
  }
  
  public int getHigherLimit() {
      return higherLimit;
  }
  
  public void setHigherLimit(int higherLimit) {
      this.higherLimit = higherLimit;
  }
  
  public int getLowerLimit() {
      return lowerLimit;
  }
  
  public void setLowerLimit(int lowerLimit) {
      this.lowerLimit = lowerLimit;
  }
  
  public double getDiscountPercentage() {
      return discountPercentage;
  }
  
  public void setDiscountPercentage(double discountPercentage) {
      this.discountPercentage = discountPercentage;
  }
  
  
  public String toString() 
  {
      StringBuffer sb = new StringBuffer("");
      sb.append("discountId: " + discountId);
      sb.append(", higherLimit:" + higherLimit);
      sb.append(", lowerLimit:" + lowerLimit);
      sb.append(", discountPercentage:" + discountPercentage);
      sb.append(super.toString());
      return sb.toString();
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>--
  -- Table structure for table `TBL_DISCOUNT_DETAIL`
  --
  
  CREATE TABLE `TBL_DISCOUNT_DETAIL` (
    `Id` int(11) NOT NULL,
    `DiscountId` int(11) NOT NULL,
    `HigherLimit` int(11) NOT NULL,
    `LowerLimit` int(11) NOT NULL,
    `DiscountPercentage` double NOT NULL,
    `CreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `CreatedBy` varchar(100) NOT NULL,
    `UpdatedOn` timestamp NULL DEFAULT NULL,
    `UpdatedBy` varchar(100) DEFAULT NULL,
    `VersionId` int(11) NOT NULL DEFAULT '1'
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  </code></pre>
  
  <p>Actual Output:</p>
  
  <p>2018-05-08 01:28:15 INFO  InventoryDAO:1052 - sql :SELECT * FROM TBL_DISCOUNT where Id=30
  2018-05-08 01:28:15 INFO  InventoryDAO:1056 - discount :<strong>discountId: 0</strong>, <strong>higherLimit:0</strong>, <strong>lowerLimit:0</strong>, <strong>discountPercentage:0.0</strong>: ID[30]: CreatedBy SYSTEM on 2018-05-07 19:06:42.0, UpdatedBy Rahul on 2018-05-07 19:06:42.0:V[2]</p>
  
  <p>Expected Output: </p>
  
  <p>2018-05-08 01:28:15 INFO  InventoryDAO:1052 - sql :SELECT * FROM TBL_DISCOUNT where Id=30
  2018-05-08 01:28:15 INFO  InventoryDAO:1056 - discount :<strong>discountId: 1</strong>, <strong>higherLimit:5</strong>, <strong>lowerLimit:20</strong>, <strong>discountPercentage:5.0</strong>: ID[30]: CreatedBy SYSTEM on 2018-05-07 19:06:42.0, UpdatedBy Rahul on 2018-05-07 19:06:42.0:V[2]</p>