0
This is the mistake I believe is easy for those who know Java but as I am learning I have not identified the problem.
GRAVE: java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: . near line 1, column 49 [select c from com.htcursos.model.entity.Cidade c.estado=:est]
Here is my City.
@SuppressWarnings("unchecked")
public List<Cidade> buscarCidades(Estado estado) {
Query consulta = em.createQuery("select c from Cidade c.estado=:est");//JPQL
consulta.setParameter("est", estado);
return consulta.getResultList();
}
If this is not enough to solve the problem, ask me for more information that I add to the post. All the help is much appreciated so thank you from now on.
UPDATE: Error after WHERE inserted:
GRAVE: java.lang.IllegalArgumentException: org.hibernate.QueryException: Unable to resolve path [c.estado], unexpected token [c] [select c from com.htcursos.model.entity.Cidade where c.estado=:est]
Tables
City
State
I put Where but another error was shown, & #Xa; org.hibernate.Queryexception: Unable to resolve path [c.status]
– Zuqui
could add the other error to the question?
– William Pereira
@Zuqui could add details about the bank you are trying to query?
– William Pereira
The one on the left is the city table and the right state
– Zuqui
What is the purpose of this method you are implementing (which data you want to search for in the bank)?
– William Pereira
I want to search the city that has the status id equal to the status table id.
– Zuqui
@Zuqui updated the answer
– William Pereira
@Zuqui, I changed the query. Try this if it doesn’t work answer me here.
– William Pereira
Hi williamhk2 worked yes thank you very much
– Zuqui