hql常识性问题求解

来源:百度知道 编辑:UC知道 时间:2024/05/13 15:19:19
hql:select new Test(sum(r.showtimes)) from Test
Test构造: public Test(Integer showtimes)
出现异常:no appropriate constructor in class
请问在hql里面这样操作是不是不支持sum?
在线等
hql为:select new Test(sum(r.showtimes)) from Test r 掉了个r
把构造换成int也不行

select new Test(sum(r.showtimes)) from Test
你确定r.showtimes 是Test表中的列,那怎么没写 from Test r

你把Test(Integer showtimes)改为Test(int showtimes)
测试下
=======
把构造换成int也不行
showtimes在数据库中为int吗,

支持的 这个异常是 你这个Test类没有这个构造方法而已