【发布时间】:2015-03-10 23:55:29
【问题描述】:
我已经编写了用于从表中获取总用户数和月份的 hibernate 本机查询。
但它显示:
exception:Operand should contain 1 column(s)
org.hibernate.exception.DataException: could not execute query
谁能帮我解决这个问题:
c.setProjection(Projections.projectionList()
.add(Projections.sqlProjection("(select count(*), MONTH(Stored) from adbtbl_stat "
+ "where Activity = 89 and YEAR(Stored) = 2015) as Count, month",
new String[] { "Count", "month" }, new Type[] { LongType.INSTANCE, StringType.INSTANCE }))
.add(Projections.groupProperty(month(stored))));
【问题讨论】:
标签: java sql hibernate orm hibernate-criteria