Uploaded image for project: 'Hibernate Integration'
  1. Hibernate Integration
  2. HIBERNATE-54

problems w/ column names beginning with '_' (underscore) w/ apache derby database

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Rejected
    • Labels:
      None
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      creating column names that are not beginning with underscore.

      Show
      creating column names that are not beginning with underscore.

      Description

      derby has problems with column names beginning with underscore, see also http://db.apache.org/derby/docs/10.1/ref/crefsqlj1003454.html
      therefore such column names should be between double quotation marks (notice that double quotation marks also sets the case sensitivity on column names.)

      but hibernate translates a HQL statement like this "from table1 t where t.id = '1'" to something like:

      select table1_.id as id4, table1_.colname1 as column27_4 schema1.table1 table1_ where table1_.id = '1'

      but because of the columns that are beginning with an underscore the translation should be:

      select table1_."id" as id4, table1_."colname1" as column27_4 schema1."table1" table1_ where table1_."id" = '1'

      the errors i got are:
      DEBUG [JDBCExceptionReporter]: could not execute query [<translated sql statement>]
      ERROR 42X01: Syntax error: Encountered "_" at line 1, column 987.
      at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
      at org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(Unknown Source)
      at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
      at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
      at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source)
      at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
      at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
      at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:497)
      at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:415)
      at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
      at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1538)
      at org.hibernate.loader.Loader.doQuery(Loader.java:661)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
      at org.hibernate.loader.Loader.doList(Loader.java:2211)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
      at org.hibernate.loader.Loader.list(Loader.java:2090)
      at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:388)
      at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
      at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
      at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
      at <mypackage>.MyHibernate.main(MyHibernate.java:13)
      WARN main org.hibernate.util.JDBCExceptionReporter - SQL Error: 20000, SQLState: 42X01
      ERROR main org.hibernate.util.JDBCExceptionReporter - Syntax error: Encountered "_" at line 1, column 987.

        Attachments

          Activity

            People

            Assignee:
            sebersole Steve Ebersole
            Reporter:
            bugra bugra uytun (Inactive)
            Archiver:
            samahaja Sagar Mahajan

              Dates

              Created:
              Updated:
              Resolved:
              Archived: