Here is my hql requete :
@Query("select a from Agent where a.visibility = true a order by a.id desc")
public Page<Agent> getAllAgents(Pageable pageable);
I want to select all agents that have visibility true.
In my Agent class a have Boolean visibility attribute with getVisibility and setVisibility functions. In my data base "visibility" stored as bit(1).
I tried a.visibility = 1, ... = '1', ...= 'TRUE', ...='true', ... is true. But i get this error :
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]
Any suggestions ? Thank you in advance.
In your code, you have to write the Alice name of the table so add it.
Change your query to this:
Your query is not correct, you have an extra
a
betweentrue
andorder by...
. So the correct query would become like thisNot sure if that fixes all your troubles. Check it out.