我想在HQL(Hibernate)中使用子查询/子选择,但它无法正常工作并抛出错误...
我想知道在HQL中是否有类似于以下内容的等效语句:(“普通”SQL)
select count(Z) from (SELECT SUM(existencia), almacen, oficina, fila from re_tinventarioubicacion where inventorybranchto = 2 GROUP BY almacen, oficina, fila, estante, entrepano, casilla, precioetiqueta) as Z
我尝试将它从SQL翻译成HQL,但是不起作用... 它会抛出以下异常:
org.hibernate.hql.ast.QuerySyntaxException: 意外的标记
基本上,我需要从结果子查询中获取行数。
有什么想法吗?