title: Getting error Could not locate appropriate constructor on class
body: <p>I am trying to map native SQL result to my POJO. Here is the configuration. I am using spring.</p>
  
  <pre><code>&lt;bean id="ls360Emf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" &gt;
      &lt;property name="dataSource" ref="ls360DataSource" /&gt;
      &lt;property name="jpaVendorAdapter" ref="vendorAdaptor" /&gt;         
      &lt;property name="packagesToScan" value="abc.xyz"/&gt;
      &lt;property name="jpaProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.SQLServerDialect&lt;/prop&gt;
              &lt;prop key="hibernate.max_fetch_depth"&gt;3&lt;/prop&gt;
              &lt;prop key="hibernate.jdbc.fetch_size"&gt;50&lt;/prop&gt;
              &lt;prop key="hibernate.jdbc.batch_size"&gt;10&lt;/prop&gt;
              &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;              
          &lt;/props&gt;        
      &lt;/property&gt;
  &lt;/bean&gt; 
  </code></pre>
  
  <p>Here is my Class</p>
  
  <pre><code>@SqlResultSetMapping(
      name="courseCompletionMapping", 
      classes = {
          @ConstructorResult(targetClass = CourseCompletion.class,
              columns={
                  @ColumnResult(name = "StoreId", type = String.class),
                  @ColumnResult(name = "ProductId", type = String.class),
                  @ColumnResult(name = "UserName", type = String.class),
                  @ColumnResult(name = "Score", type = Integer.class),
                  @ColumnResult(name = "CompletionDate", type = Date.class)
               }
          )
      }
  ) 
  @Entity
  public class CourseCompletion {
      private String storeId;
  
      @Id
      private String productId;
      private String userName;
      private int score;
      private Date completionDate;
  
      public CourseCompletion() {
      }
  
      public CourseCompletion(String storeId, String productId, String userName, int score, Date completionDate) {
          this.storeId = storeId;
          this.productId = productId;
          this.userName = userName;
          this.score = score;
          this.completionDate = completionDate;
      }
  
      // getters and setters
  </code></pre>
  
  <p>Here how i am calling it</p>
  
  <pre><code>    Properties coursePropertiesFile = SpringUtil.loadPropertiesFileFromClassPath("course.properties");
      String queryString = coursePropertiesFile.getProperty("course.completion.sql");
  
      long distributorId = 1;
      String fromDate = "2009-09-22 00:00:00";
      String toDate = "2014-04-11 23:59:59";
  
       Query query = em.createNativeQuery(queryString, "courseCompletionMapping");
  
       //Query query = em.createNamedQuery("findAllEmployeeDetails");
       query.setParameter("distributorId", distributorId);
       query.setParameter("fromDate", fromDate);
       query.setParameter("toDate", toDate);
  
       @SuppressWarnings("unchecked")
       List&lt;CourseCompletion&gt; courseCompletionList = query.getResultList();
  </code></pre>
  
  <p>But when it comes to line </p>
  
  <pre><code>List&lt;CourseCompletion&gt; courseCompletionList = query.getResultList();
  </code></pre>
  
  <p>I get an error that</p>
  
  <pre><code>Could not locate appropriate constructor on class : mypackage.CourseCompletion
  </code></pre>
  
  <p>Here is the query that i am trying </p>
  
  <pre><code>select d.DISTRIBUTORCODE AS StoreId, u.USERGUID AS ProductId, u.UserName,
      lcs.HIGHESTPOSTTESTSCORE AS Score, lcs.CompletionDate 
  from VU360User u 
  inner join learner l on u.ID = l.VU360USER_ID 
  inner join LEARNERENROLLMENT le on le.LEARNER_ID = l.ID 
  inner join LEARNERCOURSESTATISTICS lcs on lcs.LEARNERENROLLMENT_ID = le.ID 
  inner join customer c on c.ID = l.CUSTOMER_ID 
  inner join DISTRIBUTOR d on d.ID = c.DISTRIBUTOR_ID 
  where d.ID = :distributorId 
  and lcs.COMPLETIONDATE is not null 
  and (lcs.COMPLETIONDATE between :fromDate and :toDate) 
  and lcs.COMPLETED = 1
  </code></pre>
  
  <p>Why i am getting this error ?</p>
  
  <p>Thanks</p>