如何在 JPA+hibernate 3.6 中使用 postgresql array_agg

dao*_*dac 6 postgresql hibernate jpa jpa-2.0

我提出这个请求没有问题:

select ac.reg, param.alias, array_agg(numValue) 
from Sample   
group by ac.reg, param.alias  
order by ac.reg ASC
Run Code Online (Sandbox Code Playgroud)

现在,我想要的不仅仅是平均值。如何将所有值作为数组获取?我使用 postgresql 作为数据库,我知道有一个 array_agg 方法可以返回我想要的确切内容。但是这种聚合似乎没有在休眠中实现。

select ac.reg, param.alias, array_agg(numValue) 
from Sample   
group by ac.reg, param.alias  
order by ac.reg ASC
Run Code Online (Sandbox Code Playgroud)

引发异常:

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}
Run Code Online (Sandbox Code Playgroud)