title: hibernate: Unable to locate appropriate constructor on class - HQL
body: <p>When I trying to execute this HQL to return an object <code>Ponto</code> I receive this error:</p>
  
  <blockquote>
    <p>ERROR [org.hibernate.hql.PARSER] (http-localhost-127.0.0.1-8080-2) 
    Unable to locate appropriate constructor on class
    [br.com.cdv.model.entity.Ponto]
    [cause=org.hibernate.PropertyNotFoundException: no appropriate
    constructor in class: br.com.cdv.model.entity.Ponto]  </p>
  </blockquote>
  
  <p>DAO</p>
  
  <pre><code>    @SuppressWarnings("unchecked")
      @Override
      public List&lt;Ponto&gt; listLoja(Integer idLoja) {
  
          Query q = getSession().createQuery("select new Ponto(0,ss.cliente,ss.loja,null,null,null,null,null,sum(qtdPontos),'',0) "
              + "from Ponto as ss where ss.loja.id = :idLoja "
              + "group by ss.cliente, ss.loja");  
  
          q.setParameter("idLoja", idLoja);
  
          return (List&lt;Ponto&gt;) q.list();
      }  
  </code></pre>
  
  <p>My Entity / Class</p>
  
  <pre><code>@Entity
  @Table (name = "ponto")
  public class Ponto implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue
      private Integer id;
  
      @ManyToOne(fetch = FetchType.LAZY)
      @JoinColumn(name="cliente", nullable=true)
      private UsuarioCliente cliente;
  
      @ManyToOne(fetch = FetchType.LAZY)
      @JoinColumn(name="loja", nullable=false)
      private UsuarioLoja loja;
  
      @Column(name="dataCriacao")
      private Date dataCriacao;
  
      @Column(name="dataUtilizado", length=12, nullable=true)
      private Date dataUtilizado;
  
      @Column(name="dataExpira")
      private Date dataExpira;
  
      @ManyToOne(fetch = FetchType.LAZY)
      @JoinColumn(name = "funcionario", nullable=true)
      private Funcionario funcionario;
  
      @ManyToOne(fetch = FetchType.LAZY)
      @JoinColumn(name = "pontoReceber", nullable=true)
      private PontoReceber pontoReceber;
  
      @Column(name="qtdPontos", nullable=false)
      private long qtdPontos;
  
      @Column(name="obsPontos", nullable = true,length=300)
      private String obsPontos;
  
      @NotEmpty
      @Column(name="tipo",nullable = false)
      private Integer tipo;
  
      public Ponto(Integer id, UsuarioCliente cliente,UsuarioLoja loja, Date dataCriacao, Date dataUtilizado,
                Date dataExpira, Funcionario funcionario, PontoReceber pontoReceber, long qtdPontos, String obsPontos, Integer tipo) {
          setId(id);
          setCliente(cliente);
          setLoja(loja);
          setDataCriacao(dataCriacao);
          setDataUtilizado(dataUtilizado);
          setDataExpira(dataExpira);
          setFuncionario(funcionario);
          setPontoReceber(pontoReceber);
          setQtdPontos(qtdPontos);
          setObsPontos(obsPontos);
          setTipo(tipo);
      }
          // getters and setters
      }
  </code></pre>
  
  <p>Control:</p>
  
  <pre><code>@RequestMapping("/listarClientes")
      public String listarClientesPontos(Map&lt;String, Object&gt; map, HttpSession session) {
  
          ...
  
          List&lt;Ponto&gt; pontos = pontoService.listLoja(loja.getId());
  
          map.put("pontos", pontos);
  
          return "listaClientesPonto";
      }
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt;
  &lt;%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%&gt;
  &lt;%@taglib uri="http://www.springframework.org/tags" prefix="spring"%&gt;
  
  
      &lt;body&gt;
          &lt;h2&gt;Lista Clientes&lt;/h2&gt;
  
          &lt;table&gt;
            &lt;tr&gt;
              &lt;th&gt;ID Cliente&lt;/th&gt;
              &lt;th&gt;CPF Cliente&lt;/th&gt;
              &lt;th&gt;Pontos totais:&lt;/th&gt;
            &lt;/tr&gt;
  
            &lt;c:forEach items="${pontos}" var="ponto" varStatus="count"&gt;
            &lt;tr&gt;
              &lt;td&gt;${ponto.cliente.id}&lt;/td&gt;
              &lt;td&gt;${ponto.cliente.cpf}&lt;/td&gt;
              &lt;td&gt;${ponto.qtdPontos}&lt;/td&gt;
            &lt;/tr&gt;
            &lt;/c:forEach&gt;
          &lt;/table&gt;
      &lt;/body&gt;
  </code></pre>
  
  <p>Why I am getting this error?<br>
  Has any better why to receive this Object Ponto in a List?  </p>
  
  <p>obs.. without <code>new Ponto(...)</code> returns a list of Ponto with unidentified Objects[] </p>