Loading ...
Sorry, an error occurred while loading the content.

16795Re: [riojug] Hibernet from query louca

Expand Messages
  • Bruno Pina Nunes
    Jul 1, 2006
      Manda o código onde você monta o HQL.
       
      Att.

       
      On 7/1/06, Felipe Bahiana Almeida <felipe_bahiana@...> wrote:

      Oi pessoal, estou usando o hibernate3, criei uma classe que faz a interface com o banco.

      Criei uma classe de teste que testa funcionalidades, a Inserção é tudo bem. Quando tento fazer um select (from ent.Alunos as alu), ele me mostra (console do eclipse) a query parseada totalmente maluca, como podem ver abaixo.

       

      Hibernate: /* insert ent.Aluno */ insert into alunos (nomeAluno, matricAluno, emailAluno, dataNascAluno) values (?, ?, ?, ?)

      Hibernate: /* from ent.Aluno as alu */ select aluno0_.idAluno as idAluno6_, aluno0_.nomeAluno as nomeAluno6_, aluno0_.matricAluno as matricAl3_6_, aluno0_.e

       

      E da esse stack trace.

      Já tentei mtas coisas, inclusive tirar o pacote da query, mas não funciona.

      Agradeço desde já,

      Felipe Bahiana Almeida.

       

      org.hibernate.exception.GenericJDBCException: could not execute query

                  at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)

                  at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)

                  at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

                  at org.hibernate.loader.Loader.doList(Loader.java:2148)

                  at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)

                  at org.hibernate.loader.Loader.list(Loader.java:2024)

                  at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)

                  at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)

                  at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)

                  at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)

                  at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)

                  at dao.AlunoDaoHibernate.findAllAlunos (AlunoDaoHibernate.java:41)

                  at test.TestAlunoService.testSelect (TestAlunoService.java:39)

                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

                  at java.lang.reflect.Method.invoke(Unknown Source)

                  at junit.framework.TestCase.runTest(TestCase.java:154)

                  at junit.framework.TestCase.runBare(TestCase.java:127)

                  at junit.framework.TestResult$1.protect(TestResult.java:106)

                  at junit.framework.TestResult.runProtected(TestResult.java:124)

                  at junit.framework.TestResult.run(TestResult.java:109)

                  at junit.framework.TestCase.run(TestCase.java:118)

                  at junit.framework.TestSuite.runTest(TestSuite.java:208)

                  at junit.framework.TestSuite.run(TestSuite.java:203)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)

                  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

      Caused by: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Date

                  at com.mysql.jdbc.ResultSet.getNativeDateTimeValue(ResultSet.java:8128)

                  at com.mysql.jdbc.ResultSet.getNativeDate(ResultSet.java:3489)

                  at com.mysql.jdbc.ResultSet.getDate(ResultSet.java:1889)

                  at com.mysql.jdbc.ResultSet.getDate(ResultSet.java:1867)

                  at com.mysql.jdbc.ResultSet.getDate(ResultSet.java:1915)

                  at org.hibernate.type.DateType.get(DateType.java:28)

                  at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)

                  at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)

                  at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)

                  at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1899)

                  at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1372)

                  at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1300)

                  at org.hibernate.loader.Loader.getRow(Loader.java:1197)

                  at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:569)

                  at org.hibernate.loader.Loader.doQuery(Loader.java:689)

                  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)

                  at org.hibernate.loader.Loader.doList(Loader.java:2145)

                  ... 24 more

       


    • Show all 9 messages in this topic