org.hibernate.exception.SQLGrammarException: could not prepare statement

Hibernate JIRA | Scott Marlow | 4 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    {quote} org.hibernate.exception.SQLGrammarException: could not prepare statement at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:82) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:188) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:91) at org.hibernate.procedure.internal.ProcedureCallImpl.buildOutputs(ProcedureCallImpl.java:299) at org.hibernate.procedure.internal.ProcedureCallImpl.getResult(ProcedureCallImpl.java:270) at org.hibernate.jpa.internal.StoredProcedureQueryImpl.outputs(StoredProcedureQueryImpl.java:177) at org.hibernate.jpa.internal.StoredProcedureQueryImpl.execute(StoredProcedureQueryImpl.java:194) {quote} StoredProcedureQueryImpl probably needs something like: {code} catch ( HibernateException he) { entityManager().throwPersistenceException( he ); } {code} {quote} 3.10.7 Query Execution ... Runtime exceptions other than the NoResultException, NonUniqueResultException, QueryTimeoutException, and LockTimeoutException thrown by the methods of the Query, TypedQuery, and StoredProcedureQuery interfaces other than those methods specified below cause the current transaction to be marked for rollback if the persistence context is joined to the transaction. On database platforms on which a query timeout causes transaction rollback, the persistence provider must throw the PersistenceException instead of the QueryTimeoutException. Runtime exceptions thrown by the following methods of the Query, TypedQuery, and StoredProcedureQuery interfaces do not cause the current transaction to be marked for rollback: getParameters, getParameter, getParameterValue, getOutputParameterValue, getLockMode. Runtime exceptions thrown by the methods of the Tuple, TupleElement, and Parameter interfaces do not cause the current transaction to be marked for rollback {quote}

    Hibernate JIRA | 4 years ago | Scott Marlow
    org.hibernate.exception.SQLGrammarException: could not prepare statement
  2. 0

    {quote} org.hibernate.exception.SQLGrammarException: could not prepare statement at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:82) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:188) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:91) at org.hibernate.procedure.internal.ProcedureCallImpl.buildOutputs(ProcedureCallImpl.java:299) at org.hibernate.procedure.internal.ProcedureCallImpl.getResult(ProcedureCallImpl.java:270) at org.hibernate.jpa.internal.StoredProcedureQueryImpl.outputs(StoredProcedureQueryImpl.java:177) at org.hibernate.jpa.internal.StoredProcedureQueryImpl.execute(StoredProcedureQueryImpl.java:194) {quote} StoredProcedureQueryImpl probably needs something like: {code} catch ( HibernateException he) { entityManager().throwPersistenceException( he ); } {code} {quote} 3.10.7 Query Execution ... Runtime exceptions other than the NoResultException, NonUniqueResultException, QueryTimeoutException, and LockTimeoutException thrown by the methods of the Query, TypedQuery, and StoredProcedureQuery interfaces other than those methods specified below cause the current transaction to be marked for rollback if the persistence context is joined to the transaction. On database platforms on which a query timeout causes transaction rollback, the persistence provider must throw the PersistenceException instead of the QueryTimeoutException. Runtime exceptions thrown by the following methods of the Query, TypedQuery, and StoredProcedureQuery interfaces do not cause the current transaction to be marked for rollback: getParameters, getParameter, getParameterValue, getOutputParameterValue, getLockMode. Runtime exceptions thrown by the methods of the Tuple, TupleElement, and Parameter interfaces do not cause the current transaction to be marked for rollback {quote}

    Hibernate JIRA | 4 years ago | Scott Marlow
    org.hibernate.exception.SQLGrammarException: could not prepare statement

    Root Cause Analysis

    1. org.hibernate.exception.SQLGrammarException

      could not prepare statement

      at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert()
    2. Hibernate
      StatementPreparerImpl.prepareStatement
      1. org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:82)
      2. org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
      3. org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
      4. org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:188)
      5. org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareStatement(StatementPreparerImpl.java:91)
      5 frames
    3. org.hibernate.procedure
      ProcedureCallImpl.getResult
      1. org.hibernate.procedure.internal.ProcedureCallImpl.buildOutputs(ProcedureCallImpl.java:299)
      2. org.hibernate.procedure.internal.ProcedureCallImpl.getResult(ProcedureCallImpl.java:270)
      2 frames
    4. org.hibernate.jpa
      StoredProcedureQueryImpl.execute
      1. org.hibernate.jpa.internal.StoredProcedureQueryImpl.outputs(StoredProcedureQueryImpl.java:177)
      2. org.hibernate.jpa.internal.StoredProcedureQueryImpl.execute(StoredProcedureQueryImpl.java:194)
      2 frames