jpql语句语法错误,不是有效的条件表达式

时间:2019-05-30 03:23:16

标签: jpql

当EclipseLink执行此查询时,给出错误:

[175, 423] The expression is not a valid conditional expression.```

EclipseLink version is 2.7.4, use PostgreSQL database. run at Tomcat 9.0.20

welcome any propose

chang com.baremind.utils.JPAEntry.GroupCount to com.baremind.utils.JPAEntry$GroupCount (the GroupCount is inner class), but error is same

the whole method is
```java
    public static <T extends IDEntity> List<GroupCount> groupCount(Class<T> type, String conditions, String groupColumn) {
        EntityManager em = getEntityManager(type);
        String groupCountQuery = String.format("SELECT NEW %s(o.%s, COUNT(o)) FROM %s o WHERE %s GROUP BY o.%s", GroupCount.class.getName().replace('$', '.'), groupColumn, type.getSimpleName(), conditions, groupColumn);
        TypedQuery<GroupCount> q = em.createQuery(groupCountQuery, GroupCount.class);
        return q.getResultList();
    }

执行em.createQuery将引发错误。

1 个答案:

答案 0 :(得分:0)

JPQL 完全不支持移位运算符。 这是原因