hql:select new Test(sum(r.showtimes)) from Test
Test构造: public Test(Integer showtimes)
出现异常:no appropriate constructor in class
请问在hql里面这样操作是不是不支持sum?
在线等

解决方案 »

  1.   

    hql:select new Test(sum(r.showtimes)) from Test 还能这样写?HQL支持聚合函数
      

  2.   

    hql:select new Test(sum(r.showtimes)) from Test r打掉了个rhql支持聚合函数我是知道的,但是放到这个NEW操作中,是否有问题呢?
    如果我不写net,而是直接写r.showtimes就没有任何问题
      

  3.   

    如果我不写sum,而是直接写r.showtimes就没有任何问题
      

  4.   

    这样写是不对的吧!hql还支持这个Test(sum(r.showtimes)) ?晕……
      

  5.   

    hql支持聚合函数的 你自己写的不对
      

  6.   

    在Test类中添加一个构造方法
    private int sum;
    public Test(int sum){
       this.sum=sum;
    }
      

  7.   

    囧了`~  看来不能解决呀我换了种变通的方式来解决,直接new map(.....)就没有问题了,这样JSP上面也不用改参数了.