【发布时间】:2017-08-23 13:16:44
【问题描述】:
这是我的 hql 代码:
@Query("select a from Agent where a.visibility = true a order by a.id desc")
public Page<Agent> getAllAgents(Pageable pageable);
我想选择所有可见性为真的代理。
在我的代理类中,我有布尔可见性属性,它在数据库中存储为 bit(1)。
我试过这个: a.visibility = true, ... = 'true', ... is true, = 1, = '1',....
但是得到这个错误:
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: a near line 1, column 74 [select a from com.GemCrmTickets.entities.Agent where a.visibility = true a order by a.id desc]
请有任何建议。先感谢您。提前谢谢你。
【问题讨论】:
-
您的查询中有错字,错误非常明确:
unexpected token: a。删除a.visibility = true之后和order by之前的a。它应该可以工作。 -
不要一遍又一遍地问同一个问题...stackoverflow.com/questions/45840854/…
标签: hibernate spring-boot hql