数据加载器中的group by的使用

数据加载器中的jpql无法使用group by,jpql如下
select e.exam,s.class from examRecord e left join e.student s group by e.exam,s.class
examRecord表包括考试的学生(student)和考试(exam)两个字段,学生表中包括班级(class)字段,现在希望通过group by实现班级和考试的对应
想实现效果如下:
image
数据库中执行该语句正常显示,但写在数据加载器中报错
请问有什么解决的方法吗?

报的错请贴一下,另外,使用的什么数据库?

09:07:25.343 ERROR c.h.cuba.core.sys.ServiceInterceptor - Exception:
java.lang.IllegalArgumentException: Query select e.exam,s.class from examRecord e left join e.student s group by e.exam,s.class, query hint eclipselink.left-join-fetch is not valid for this type of query.
at org.eclipse.persistence.internal.jpa.QueryHintsHandler$LeftFetchHint.applyToDatabaseQuery(QueryHintsHandler.java:1609) ~[org.eclipse.persistence.jpa-2.7.3-6-cuba.jar:na]
at org.eclipse.persistence.internal.jpa.QueryHintsHandler$Hint.apply(QueryHintsHandler.java:380) ~[org.eclipse.persistence.jpa-2.7.3-6-cuba.jar:na]
at org.eclipse.persistence.internal.jpa.QueryHintsHandler$Hint.apply(QueryHintsHandler.java:358) ~[org.eclipse.persistence.jpa-2.7.3-6-cuba.jar:na]
at org.eclipse.persistence.internal.jpa.QueryHintsHandler.apply(QueryHintsHandler.java:179) ~[org.eclipse.persistence.jpa-2.7.3-6-cuba.jar:na]
at org.eclipse.persistence.internal.jpa.QueryImpl.setHintInternal(QueryImpl.java:776) ~[org.eclipse.persistence.jpa-2.7.3-6-cuba.jar:na]
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setHint(EJBQueryImpl.java:285) ~[org.eclipse.persistence.jpa-2.7.3-6-cuba.jar:na]
at com.haulmont.cuba.core.sys.FetchGroupManager.applyView(FetchGroupManager.java:123) ~[cuba-core-7.1.1.jar:7.1.1]
at com.haulmont.cuba.core.sys.FetchGroupManager.setView(FetchGroupManager.java:67) ~[cuba-core-7.1.1.jar:7.1.1]
at com.haulmont.cuba.core.sys.QueryImpl.getQuery(QueryImpl.java:189) ~[cuba-core-7.1.1.jar:7.1.1]
at com.haulmont.cuba.core.sys.QueryImpl.getResultList(QueryImpl.java:408) ~[cuba-core-7.1.1.jar:7.1.1]
at com.haulmont.cuba.core.app.RdbmsStore.executeQuery(RdbmsStore.java:841) ~[cuba-core-7.1.1.jar:7.1.1]
at com.haulmont.cuba.core.app.RdbmsStore.getResultList(RdbmsStore.java:749) ~[cuba-core-7.1.1.jar:7.1.1]
at com.haulmont.cuba.core.app.RdbmsStore.loadList(RdbmsStore.java:233) ~[cuba-core-7.1.1.jar:7.1.1]
at com.haulmont.cuba.core.app.DataManagerBean.loadList(DataManagerBean.java:78) ~[cuba-core-7.1.1.jar:7.1.1]

使用的是国产数据库Gbase,该jpql语句换成sql写法在数据库可以正常执行

对于这种依赖数据库特性的地方改成用 NativeQuery, JPQL 依赖底层 eclipseLink 的实现,显然不能很好的支持 GBase。

1赞