JPA/Hibernate e PostgreSQL

5 respostas
deiome

ola a todos, estou tentando realizar uma consulta com hibernate e banco postgres, e sempre q tento realizar uma query recebo esse erro :

PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
        at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630)
        at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:108)
        org.hibernate.exception.SQLGrammarException: could not execute query
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.loader.Loader.doList(Loader.java:2223)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
        at org.hibernate.loader.Loader.list(Loader.java:2099)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
        at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
        at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
        at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:82)
        
        org.postgresql.util.PSQLException: ERROR: relation "cnpj_rf" does not exist
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1592)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1327)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:192)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:350)

        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
        at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
        at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
        at org.hibernate.loader.Loader.doQuery(Loader.java:674)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
        at org.hibernate.loader.Loader.doList(Loader.java:2220)

alguem faz ideia de qual possa ser o erro??

5 Respostas

W

Verifica se não tem erro de sintaxe!

http://www.hibernate.org/hib_docs/v3/api/org/hibernate/exception/SQLGrammarException.html

sf.marcius

pela linha:

org.postgresql.util.PSQLException: ERROR: relation "cnpj_rf" does not exist

tem que ser algo errado com relação a esse “cnpj_rf”.

deiome

cnpj_rf é o nome da minha tabela…

ela tem uns 16M de registro, e eu peguei um com o pgadmin e estou tentando consultar para testar o meu programa em java…

porem qndo ele tenta realizar a consulta vem esse erro gigante…

furutani

Posta a sua query e o mapeamento que vc faz a essa tabela.

deiome

naum precisa mais, desisti do JPA e to fazendo com JDBC mesmo …

Criado 6 de janeiro de 2009
Ultima resposta 7 de jan. de 2009
Respostas 5
Participantes 4