[Resolvido]Ajuda com org.hibernate.hql.ast.QuerySyntaxException no Hibernate

1 resposta
alexfe

Pessoal não sei o porque, mas está consulta não está dando certo e não consigo achar o porque.

Código referente a consulta:

private static final String EJBQL = "select pessoaFisica from PessoaFisica pessoaFisica"; . . . setEjbql(EJBQL); . . . pessoaFisica = (PessoaFisica) getEntityManager().createQuery(getEjbql() + " where cpf = "+cpf).getSingleResult();

Abaixo segue o log de erro.

line 1:74: unexpected token:698536598 java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 698536598near line 1, column 74 [select pessoaFisica from classes.PessoaFisica pessoaFisica where cpf = [telefone removido]] org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:601) . . . Caused by: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 698536598near line 1, column 74 [select pessoaFisica from classes.PessoaFisica pessoaFisica where cpf = [telefone removido]] at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)

Alguem pode me ajudar ??? :slight_smile:

1 Resposta

alexfe

Resolvido

esqueci das aspas simples para consultas com string

(“O ministerio adverte. Programar a noite com sono causa Bugs”)

Criado 10 de fevereiro de 2011
Ultima resposta 10 de fev. de 2011
Respostas 1
Participantes 1