Sun Java System Application Server Platform Edition 9 发行说明

如果查询按 JOIN 变量分组且直接选择 JOIN 变量,则可能会导致 SQLException

如果查询按 JOIN 变量分组且直接选择 JOIN 变量,则可能会导致 SQLException 报告选定的表达式未分组。有关更多信息,请参见 https://glassfish.dev.java.net/issues/show_bug.cgi?id=197。例如:


SELECT AVG(o.totalPrice), c FROM Order o JOIN o.customer c GROUP BY c

解决方法

可能的解决方法是直接浏览此关系,而不是定义 JOIN 变量,例如:


SELECT AVG(o.totalPrice), o.customer FROM Order GROUP BY o.customer