javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute statement 19:42:54.374 [PMPUTestBot Telegram Executor] DEBUG org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl - Implicitly destroying Boot-strap registry on de-registration of all child ServiceRegistries

Stack Overflow | Vlad Yurevich | 2 months ago
  1. 0

    Can't create entity with Hibernate. SQLGrammarException

    Stack Overflow | 2 months ago | Vlad Yurevich
    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute statement 19:42:54.374 [PMPUTestBot Telegram Executor] DEBUG org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl - Implicitly destroying Boot-strap registry on de-registration of all child ServiceRegistries
  2. 0

    Fehler beim Speichern von Berichten mit Vorfilter (Page 1) / ReportServer (DE) / ReportServer Forum

    reportserver.net | 4 months ago
    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute statement
  3. 0

    Hibernate @MapKeyColumn and table inheritance causing Unknown column type exception

    Stack Overflow | 2 years ago | user3874819
    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute statement
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Cannot build geo-platform-1.6.x and also geo-platform-master (1.7)

    GitHub | 2 years ago | thanhgis
    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
  6. 0

    As simples as that: 1: Query q = em.createNativeQuery("select cd_person as codePerson, cd_person as identif from PERSON"); 2: List<Object[]> resultList = (List<Object[]>) q.getResultList(); Hibernate is ignoring my aliases when retrieving information from the ResultSet because it is trying to retrieve by column name, generating the following error: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:641) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73) at <my line 2 in the code above> ... Caused by: 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:2147) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) at org.hibernate.loader.Loader.list(Loader.java:2023) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64) ... Caused by: java.sql.SQLException: S0022: Invalid column name 'cd_person'. at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source) at com.sybase.jdbc3.tds.TdsResultSet.findColumnByLabel(Unknown Source) at com.sybase.jdbc3.jdbc.SybResultSet.findColumn(Unknown Source) at com.sybase.jdbc3.jdbc.SybResultSet.getInt(Unknown Source) at org.jboss.resource.adapter.jdbc.WrappedResultSet.getInt(WrappedResultSet.java:690) at org.hibernate.type.IntegerType.get(IntegerType.java:28) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:139) at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.extract(CustomLoader.java:474) at org.hibernate.loader.custom.CustomLoader$ResultRowProcessor.buildResultRow(CustomLoader.java:420) at org.hibernate.loader.custom.CustomLoader.getResultColumnOrRow(CustomLoader.java:317) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:594) 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:2144) Awesome! The SQL query runs, but the Hibernate try to get the column by the original name, not by the alias, causing the error! It is not possible to correctly get the value of 2 different columns that have the same name!!!! Hint: why Hibernate use ResultSet.get* by column name instead of positional ResultSet.get* (1, 2, 3,...)? It will solve this problem.

    Hibernate JIRA | 1 decade ago | Leonardo Penczek
    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.persistence.PersistenceException

      org.hibernate.exception.SQLGrammarException: could not execute statement 19:42:54.374 [PMPUTestBot Telegram Executor] DEBUG org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl - Implicitly destroying Boot-strap registry on de-registration of all child ServiceRegistries

      at org.hibernate.internal.ExceptionConverterImpl.convert()
    2. Hibernate
      JdbcCoordinatorImpl.beforeTransactionCompletion
      1. org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:147)
      2. org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:155)
      3. org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:162)
      4. org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1411)
      5. org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:475)
      6. org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3168)
      7. org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2382)
      8. org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:467)
      8 frames
    3. org.hibernate.resource
      JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit
      1. org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:146)
      2. org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$100(JdbcResourceLocalTransactionCoordinatorImpl.java:38)
      3. org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:220)
      3 frames
    4. Hibernate
      TransactionImpl.commit
      1. org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:68)
      1 frame
    5. dao
      GroupDaoImpl.initGroup
      1. dao.GroupDaoImpl.initGroup(GroupDaoImpl.java:32)
      1 frame