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

Hibernate JIRA | Hector Suarez Barenca | 1 decade ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    ---------- <hibernate-mapping package="mx.com.dtc.ayde.model"> <class name="Instancia" table="INSTANCIA"> <id name="id" column="ID" type="java.lang.Long"> <generator class="sequence"> <param name="sequence">sec_instancia</param> </generator> </id> <property name="fecha" column="FECHA" type="java.util.Date" /> <property name="titulo" column="TITULO" type="java.lang.String" /> <property name="version" column="VERSION" type="java.lang.Long" not-null="true"/> <property name="documento" column="DOCUMENTO" type="java.lang.Long" /> <property name="nombreArchivo" column="NOMBRE_ARCHIVO" type="java.lang.String"/> <many-to-one name="plantilla" column="PLANTILLA_ID" class="Plantilla" lazy="false"/> <many-to-one name="usuario" column="USUARIO_ID" class="Usuario" lazy="false"/> <many-to-one name="creador" column="CREADOR_ID" class="Usuario" lazy="false"/> <bag name="datos" inverse="true" lazy="false"> <key column="INSTANCIA_ID"/> <one-to-many class="DatoPlantilla"/> </bag> </class> </hibernate-mapping> ----------------- <hibernate-mapping package="mx.com.dtc.ayde.model"> <class name="UsuarioInstancia" table="USUARIO_INSTANCIA"> <composite-id name="id" class="UsuarioInstanciaKey"> <key-many-to-one name="instancia" column="INSTANCIA_ID" class="Instancia"/> <key-many-to-one name="usuario" column="USUARIO_ID" class="Usuario"/> </composite-id> <property name="lectura" column="LECTURA" type="java.lang.String" /> </class> </hibernate-mapping> from Instancia as i where i.version = ( select max(i2.version) as version from UsuarioInstancia ui right outer join ui.id.instancia i2 where i2.documento=? and (i2.usuario=? or ui.id.usuario=?) ) and i.documento=? this will generate: 13:39:57,906 DEBUG SQL:324 - select instancia0_.ID as ID, instancia0_.FECHA as FECHA6_, instancia0_.TITULO as TITULO6_, instancia0_.VERSION as VERSION6_, instancia0_.DOCUMENTO as DOCUMENTO6_, instancia0_.NOMBRE_ARCHIVO as NOMBRE6_6_, instancia0_.PLANTILLA_ID as PLANTILLA7_6_, instancia0_.USUARIO_ID as USUARIO8_6_, instancia0_.CREADOR_ID as CREADOR9_6_ from INSTANCIA instancia0_ where instancia0_.VERSION=(select instancia2_.VERSION from USUARIO_INSTANCIA usuarioins1_, right outer join INSTANCIA instancia2_ on usuarioins1_.INSTANCIA_ID=instancia2_.ID where instancia2_.DOCUMENTO=? and (instancia2_.USUARIO_ID=? or usuarioins1_.USUARIO_ID=?) and instancia2_.VERSION=?) and instancia0_.DOCUMENTO=? 13:39:58,000 WARN JDBCExceptionReporter:71 - SQL Error: 942, SQLState: 42000 13:39:58,000 ERROR JDBCExceptionReporter:72 - ORA-00942: table or view does not exist 13:39:58,203 ERROR ControlVersionesAction:72 - org.hibernate.exception.SQLGrammarException: could not execute query org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:1596) at org.hibernate.loader.Loader.list(Loader.java:1577) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) --- and it seems to be because of this: from INSTANCIA instancia0_ where instancia0_.VERSION=(select instancia2_.VERSION from USUARIO_INSTANCIA usuarioins1_, right outer join INSTANCIA instancia2_ on usuarioins1_.INSTANCIA_ID=instancia2_.ID it takes "right outer " like a table name! Regards

    Hibernate JIRA | 1 decade ago | Hector Suarez Barenca
    org.hibernate.exception.SQLGrammarException: could not execute query
  2. 0

    Hibernate Community • View topic - Problems with HQL

    hibernate.org | 12 months ago
    org.hibernate.exception.SQLGrammarException: could not execute query
  3. 0

    ---------- <hibernate-mapping package="mx.com.dtc.ayde.model"> <class name="Instancia" table="INSTANCIA"> <id name="id" column="ID" type="java.lang.Long"> <generator class="sequence"> <param name="sequence">sec_instancia</param> </generator> </id> <property name="fecha" column="FECHA" type="java.util.Date" /> <property name="titulo" column="TITULO" type="java.lang.String" /> <property name="version" column="VERSION" type="java.lang.Long" not-null="true"/> <property name="documento" column="DOCUMENTO" type="java.lang.Long" /> <property name="nombreArchivo" column="NOMBRE_ARCHIVO" type="java.lang.String"/> <many-to-one name="plantilla" column="PLANTILLA_ID" class="Plantilla" lazy="false"/> <many-to-one name="usuario" column="USUARIO_ID" class="Usuario" lazy="false"/> <many-to-one name="creador" column="CREADOR_ID" class="Usuario" lazy="false"/> <bag name="datos" inverse="true" lazy="false"> <key column="INSTANCIA_ID"/> <one-to-many class="DatoPlantilla"/> </bag> </class> </hibernate-mapping> ----------------- <hibernate-mapping package="mx.com.dtc.ayde.model"> <class name="UsuarioInstancia" table="USUARIO_INSTANCIA"> <composite-id name="id" class="UsuarioInstanciaKey"> <key-many-to-one name="instancia" column="INSTANCIA_ID" class="Instancia"/> <key-many-to-one name="usuario" column="USUARIO_ID" class="Usuario"/> </composite-id> <property name="lectura" column="LECTURA" type="java.lang.String" /> </class> </hibernate-mapping> from Instancia as i where i.version = ( select max(i2.version) as version from UsuarioInstancia ui right outer join ui.id.instancia i2 where i2.documento=? and (i2.usuario=? or ui.id.usuario=?) ) and i.documento=? this will generate: 13:39:57,906 DEBUG SQL:324 - select instancia0_.ID as ID, instancia0_.FECHA as FECHA6_, instancia0_.TITULO as TITULO6_, instancia0_.VERSION as VERSION6_, instancia0_.DOCUMENTO as DOCUMENTO6_, instancia0_.NOMBRE_ARCHIVO as NOMBRE6_6_, instancia0_.PLANTILLA_ID as PLANTILLA7_6_, instancia0_.USUARIO_ID as USUARIO8_6_, instancia0_.CREADOR_ID as CREADOR9_6_ from INSTANCIA instancia0_ where instancia0_.VERSION=(select instancia2_.VERSION from USUARIO_INSTANCIA usuarioins1_, right outer join INSTANCIA instancia2_ on usuarioins1_.INSTANCIA_ID=instancia2_.ID where instancia2_.DOCUMENTO=? and (instancia2_.USUARIO_ID=? or usuarioins1_.USUARIO_ID=?) and instancia2_.VERSION=?) and instancia0_.DOCUMENTO=? 13:39:58,000 WARN JDBCExceptionReporter:71 - SQL Error: 942, SQLState: 42000 13:39:58,000 ERROR JDBCExceptionReporter:72 - ORA-00942: table or view does not exist 13:39:58,203 ERROR ControlVersionesAction:72 - org.hibernate.exception.SQLGrammarException: could not execute query org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:1596) at org.hibernate.loader.Loader.list(Loader.java:1577) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74) --- and it seems to be because of this: from INSTANCIA instancia0_ where instancia0_.VERSION=(select instancia2_.VERSION from USUARIO_INSTANCIA usuarioins1_, right outer join INSTANCIA instancia2_ on usuarioins1_.INSTANCIA_ID=instancia2_.ID it takes "right outer " like a table name! Regards

    Hibernate JIRA | 1 decade ago | Hector Suarez Barenca
    org.hibernate.exception.SQLGrammarException: could not execute query
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Full text search exception with special characters in PostgreSQL

    Stack Overflow | 4 years ago | christopher wilbert
    org.hibernate.exception.SQLGrammarException: could not execute query
  6. 0

    selecting list of object using HQL when the object is a property of another entity class

    Stack Overflow | 2 years ago
    org.hibernate.exception.SQLGrammarException: could not execute query

    3 unregistered visitors
    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. org.hibernate.exception.SQLGrammarException

      could not execute query

      at org.hibernate.exception.ErrorCodeConverter.convert()
    2. Hibernate
      QueryLoader.list
      1. org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
      2. org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      3. org.hibernate.loader.Loader.doList(Loader.java:1596)
      4. org.hibernate.loader.Loader.list(Loader.java:1577)
      5. org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
      5 frames
    3. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.list
      1. org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
      1 frame
    4. Hibernate
      QueryImpl.list
      1. org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
      2. org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
      2 frames