算术表达式-JPA和命名查询

时间:2017-04-09 18:41:03

标签: java mysql jpa

当我尝试通过此代码运行查询时出现错误。该查询已经过测试,并且在命名查询之外工作。但是,当我尝试在命名查询中使用时,它不起作用。

代码:

  @NamedQuery(name = "User.getBasketballPos", query = "SELECT 1 + count(*) as rank FROM user u WHERE u.basketballScore > (SELECT u2.basketballScore FROM user u2 WHERE u2.username = :username) ")

错误:

Exception Description: Syntax error parsing [SELECT 1 + count(*) as rank FROM user u WHERE u.basketballScore > (SELECT u2.basketballScore FROM user u2 WHERE u2.username = :username) ]. 

[17,17]算术表达式中缺少左表达式。 [18,18]算术表达式中缺少正确的表达式。

我搜索了互联网,但没有一个解决方案似乎有效。 有人知道吗?

0 个答案:

没有答案