3
respostas

Como posso resolver

mar 27, 2019 10:06:49 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions WARN: SQL Error: 0, SQLState: S1000 mar 27, 2019 10:06:49 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions ERROR: Unknown type '246 in column 5 of 6 in binary-encoded result set. Exception in thread "main" javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not extract ResultSet at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181) at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1538) at org.hibernate.query.Query.getResultList(Query.java:165) at br.com.italo.financas.teste.TesteJPQL.main(TesteJPQL.java:22) Caused by: org.hibernate.exception.GenericJDBCException: could not extract ResultSet at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:69) at org.hibernate.loader.Loader.getResultSet(Loader.java:2173) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1936) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1898) at org.hibernate.loader.Loader.doQuery(Loader.java:937) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:340) at org.hibernate.loader.Loader.doList(Loader.java:2695) at org.hibernate.loader.Loader.doList(Loader.java:2678) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2512) at org.hibernate.loader.Loader.list(Loader.java:2507) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:504) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:396) at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:224) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1538) at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1561) at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1529) ... 2 more

3 respostas

Posta seu código para darmos uma olhada a

package br.com.italo.financas.teste;

import java.util.List;

import javax.persistence.EntityManager; import javax.persistence.Query;

import br.com.italo.financas.modelo.Movimentacao; import br.com.italo.financas.util.JPAUtil;

public class TesteJPQL {

public static void main(String[] args) {
    // TODO Auto-generated method stub

    EntityManager em = new JPAUtil().getEntityManager();
    em.getTransaction().begin();

    String query = "select m from Movimentacao m where m.conta.id= 1";
    Query q = em.createQuery(query);

    List<Movimentacao> resultados = q.getResultList();

    for(Movimentacao m: resultados)
    {
        System.out.println(m.getDescricao());
        System.out.println(m.getId());
    }        
    em.getTransaction().commit();
    em.close();
}

}

Opa blz? ja tentou fazer o select com o m minusculo da class Movimentacao?

 String query = "select m from movimentacao m where m.conta.id= 1";