OpenJPA
  1. OpenJPA
  2. OPENJPA-1217

Ensure comparisons do not contain two parameters with Derby (ie SELECT ... WHERE ? = ?)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M2
    • Fix Version/s: 2.0.0-M3
    • Component/s: jdbc
    • Labels:
      None
    • Environment:
      Derby Embedded

      Description

      The problem appears to be Derby specific and can be seen by running o.a.o.p.c.TestTypesafeCriteria.testTrue() and testFalse().

      It's not related to criteria - the problem exists in the JPQL query. I believe I've seen this issue before but couldn't find it in JIRA. The relevant stack traces follow:

      Caused by: <openjpa-2.0.0-SNAPSHOT-r422266:799520 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: It is not allowed for both operands of '=' to be ? parameters.

      {SELECT t0.id, t0.DTYPE, t0.name FROM CR_PSN t0 WHERE (? = ?)} [code=30000, state=42X35]
      at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4554)
      at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4507)
      at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:102)
      at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:88)
      at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:64)
      at org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.handleCheckedException(SelectResultObjectProvider.java:155)
      at org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:40)
      at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1232)
      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:993)
      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:849)
      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:780)
      at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:525)
      at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:287)
      at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:299)
      at org.apache.openjpa.persistence.criteria.CriteriaTest.executeQueryAndCollectSQL(CriteriaTest.java:379)
      ... 23 more
      Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: It is not allowed for both operands of '=' to be ? parameters. {SELECT t0.id, t0.DTYPE, t0.name FROM CR_PSN t0 WHERE (? = ?)}

      [code=30000, state=42X35]
      at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:245)
      at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$000(LoggingConnectionDecorator.java:69)
      at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection.prepareStatement(LoggingConnectionDecorator.java:279)
      at org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:188)
      at org.apache.openjpa.lib.jdbc.ConfiguringConnectionDecorator$ConfiguringConnection.prepareStatement(ConfiguringConnectionDecorator.java:156)
      at org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:188)
      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$RefCountConnection.prepareStatement(JDBCStoreManager.java:1519)
      at org.apache.openjpa.lib.jdbc.DelegatingConnection.prepareStatement(DelegatingConnection.java:177)
      at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:530)
      at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:510)
      at org.apache.openjpa.jdbc.sql.SelectImpl.prepareStatement(SelectImpl.java:450)
      at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:391)
      at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:363)
      at org.apache.openjpa.jdbc.sql.LogicalUnion$UnionSelect.execute(LogicalUnion.java:427)
      at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:230)
      at org.apache.openjpa.jdbc.sql.LogicalUnion.execute(LogicalUnion.java:220)
      at org.apache.openjpa.jdbc.kernel.SelectResultObjectProvider.open(SelectResultObjectProvider.java:94)
      at org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:34)
      ... 31 more

        Activity

        Hide
        Pinaki Poddar added a comment -
        Show
        Pinaki Poddar added a comment - See OPENJPA-1013

          People

          • Assignee:
            Pinaki Poddar
            Reporter:
            Michael Dick
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development