我毫无疑问地提出了这个请求:
select ac.reg, param.alias, array_agg(numValue)
from Sample
group by ac.reg, param.alias
order by ac.reg ASC
现在,我想要的不仅仅是平均值。如何将所有值作为数组获取?我使用postgresql作为DB,我知道有一个array_agg方法可以返回exaclty我想要的东西。但是这种聚合似乎没有在hibernate中实现。
select ac.reg, param.alias, array_agg(numValue)
from Sample
group by ac.reg, param.alias
order by ac.reg ASC
提出异常:
A java.lang.IllegalStateException has been caught, No data type for node: org.hibernate.hql.ast.tree.MethodNode
\-[METHOD_CALL] MethodNode: '(' +-[METHOD_NAME] IdentNode: 'array_agg' {originalText=array_agg} \-[EXPR_LIST] SqlNode: 'exprList' \-[DOT] DotNode: 'sample0_.num_value'
{propertyName=numValue,dereferenceType=ALL,propertyPath=numValue,path={synthetic-alias}.numValue,tableAlias=sample0_,className=models.Sample,classAlias=null} +-[IDENT] IdentNode: '{synthetic-alias}' {originalText={synthetic-alias}} \-[IDENT] IdentNode: 'numValue' {originalText=numValue}