title: Provided id of the wrong type for class classname Expected: class java.lang.Integer, got class java.lang.String
body: <p>Here is my sql table description</p>
  
  <pre><code>desc product_details;
  +--------------------+-------------+------+-----+---------+-------+
  | Field              | Type        | Null | Key | Default | Extra |
  +--------------------+-------------+------+-----+---------+-------+
  | action             | varchar(5)  | YES  |     | NULL    |       |
  | version            | varchar(2)  | YES  |     | NULL    |       |
  | productCatalogName | varchar(50) | YES  |     | NULL    |       |
  | productId          | varchar(25) | NO   |     | NULL    |       |
  | price              | varchar(10) | NO   |     | NULL    |       |
  | Operator_Code      | varchar(7)  | YES  |     | NULL    |       |
  | product_name       | varchar(70) | YES  |     | NULL    |       |
  | subs_id            | int(11)     | NO   | PRI | 0       |       |
  +--------------------+-------------+------+-----+---------+-------+
  </code></pre>
  
  <blockquote>
    <p>Every time when i call the get method</p>
  </blockquote>
  
  <pre><code>ProductDetail productDetail = (ProductDetail )session.get(ProductDetail .class, subs_id);
  </code></pre>
  
  <blockquote>
    <p>i am getting exception:</p>
  </blockquote>
  
  <pre><code>nested exception is org.hibernate.TypeMismatchException: Provided id of the wrong type for class tpay.table.ProductDetail. Expected: class java.lang.Integer, got class java.lang.String
  
  
  
  
  package tpay.table;
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  @Entity
  @Table(name="product_details")
  public class ProductDetail {
  
      @Id
      @Column(name="subs_id")
       int subs_id;
  
      @Column(name="action")
      String action;
  
      @Column(name="version")
      String version;
  
      @Column(name="productCatalogName")
      String productCatalogName;
  
      @Column(name="productId")
      String productId;
  
      @Column(name="price")
      String price;
  
      @Column(name="Operator_Code")
      String Operator_Code;
  
      @Column(name="product_name")
      String product_name;
  
  
  
  public String getAction() {
      return action;
  }
  
  public void setAction(String action) {
      this.action = action;
  }
  
  public String getVersion() {
      return version;
  }
  
  public void setVersion(String version) {
      this.version = version;
  }
  
  public String getProductCatalogName() {
      return productCatalogName;
  }
  
  public void setProductCatalogName(String productCatalogName) {
      this.productCatalogName = productCatalogName;
  }
  
  public String getProductId() {
      return productId;
  }
  
  public void setProductId(String productId) {
      this.productId = productId;
  }
  
  public String getPrice() {
      return price;
  }
  
  public void setPrice(String price) {
      this.price = price;
  }
  
  public String getOperator_Code() {
      return Operator_Code;
  }
  
  public void setOperator_Code(String operator_Code) {
      Operator_Code = operator_Code;
  }
  
  public String getProduct_name() {
      return product_name;
  }
  
  public void setProduct_name(String product_name) {
      this.product_name = product_name;
  }
  
  public int getSubs_id() {
      return subs_id;
  }
  
  public void setSubs_id(int subs_id) {
      this.subs_id = subs_id;
  }   
  
  
  
  }
  </code></pre>
  
  <blockquote>
    <p>As you can see i have already use int variable for the primary key subs_id 
    then why its giving exception
    Provided id of the wrong type for class tpay.table.ProductDetail. Expected: class java.lang.Integer, got class java.lang.String</p>
  </blockquote>