title: Hibernate MYSQL native query throws ClassCastException
body: <p>Retrieving integer value from table using Hibernate, following exception occurred, </p>
  
  <blockquote>
    <p>java.lang.ClassCastException: java.lang.Integer cannot be cast to
    pojo.Datasetstatus</p>
  </blockquote>
  
  <pre><code>String q1="SELECT datasetstatusID from datasetstatus where DatasetID='"+meta_dataset+"'";
  Query query=session.createSQLQuery(q1);
  List&lt;Datasetstatus&gt; dobj=query.list();
  for(Datasetstatus dobj1: dobj) {        
      System.out.println("Value   :: "+dobj1.getDatasetStatusId());
      }
  </code></pre>
  
  <p>Pojo class format,</p>
  
  <pre><code>    public class Datasetstatus implements java.io.Serializable {
  
      private Integer datasetStatusId;    
      private String datasetId;
  
      public Datasetstatus(String datasetId) {
          this.datasetId = datasetId;
      }
  
      public Integer getDatasetStatusId() {
          return this.datasetStatusId;
      }
  
      public void setDatasetStatusId(Integer datasetStatusId) {
          this.datasetStatusId = datasetStatusId;
      }
  
      public String getDatasetId() {
          return this.datasetId;
      }
  
      public void setDatasetId(String datasetId) {
          this.datasetId = datasetId;
      }
  }
  </code></pre>
  
  <p>If any suggestions for solving this problem</p>