Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Estou com dúvida no curso de JPA 2: Introdução à persistência de dados com JPA e Hibernate, no exercício do capítulo Pesquisas orientado a objetos com JPQL.

Minha saída deu uma exceção:

ERROR: line 1:76: unexpected token: : line 1:76: unexpected token: : at org.hibernate.hql.internal.antlr.HqlBaseParser.atom(HqlBaseParser.java:3688) at org.hibernate.hql.internal.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:3376) at org.hibernate.hql.internal.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:3248) at org.hibernate.hql.internal.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2954) at org.hibernate.hql.internal.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:590) at org.hibernate.hql.internal.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2721) at org.hibernate.hql.internal.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2582) at org.hibernate.hql.internal.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2546) at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:2462) at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:2427) at org.hibernate.hql.internal.antlr.HqlBaseParser.expression(HqlBaseParser.java:2137) at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalExpression(HqlBaseParser.java:1913) at org.hibernate.hql.internal.antlr.HqlBaseParser.whereClause(HqlBaseParser.java:474) at org.hibernate.hql.internal.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:729) at org.hibernate.hql.internal.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:316) at org.hibernate.hql.internal.antlr.HqlBaseParser.statement(HqlBaseParser.java:179) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:295) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:203) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158) at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:126) at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:88) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:190) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:328) at br.com.caelum.financas.teste.TesteConsulta.main(TesteConsulta.java:21)

Abr 15, 2014 3:56:43 AM org.hibernate.hql.internal.ast.HqlParser processEqualityExpression WARN: HHH000203: processEqualityExpression() : No expression to process! Exception in thread "main" java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: : near line 1, column 76 [select m from br.com.caelum.financas.modelo.Movimentacao m where m.conta.id:pConta] at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1750) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1683) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:331) at br.com.caelum.financas.teste.TesteConsulta.main(TesteConsulta.java:21) Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: : near line 1, column 76 [select m from br.com.caelum.financas.modelo.Movimentacao m where m.conta.id:pConta] at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:91) at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:109) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:304) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:203) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158) at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:126) at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:88) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:190) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1800) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:328) ... 1 more

1 resposta
solução!

Glaison pode postar seu código ? Parece que a comparação do m.conta.id com o conta.getId() não está batendo.