OpenJPA
  1. OpenJPA
  2. OPENJPA-1601

IndexOutOfBoundsException when querying on entity with embeddable compound key

    Details

      Description

      When querying on inheritance entities with compound key, OpenJPA will report the following exception:

      Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
      at java.util.ArrayList.RangeCheck(ArrayList.java:547)
      at java.util.ArrayList.get(ArrayList.java:322)
      at org.apache.openjpa.jdbc.sql.SQLBuffer.setParameters(SQLBuffer.java:615)
      at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:515)
      at org.apache.openjpa.jdbc.sql.SQLBuffer.prepareStatement(SQLBuffer.java:471)
      at org.apache.openjpa.jdbc.sql.SelectImpl.prepareStatement(SelectImpl.java:463)
      at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:379)
      at org.apache.openjpa.jdbc.sql.SelectImpl.execute(SelectImpl.java:325)
      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.getInitializeStateResult(JDBCStoreManager.java:503)
      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:322)
      at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:278)
      at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
      at org.apache.openjpa.datacache.DataCacheStoreManager.initialize(DataCacheStoreManager.java:352)
      at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
      at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
      at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:913)
      at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:871)

        Activity

        Kelvin Law created issue -
        Hide
        Kelvin Law added a comment -

        Attached test case to illustrate the problem.

        Show
        Kelvin Law added a comment - Attached test case to illustrate the problem.
        Kelvin Law made changes -
        Field Original Value New Value
        Attachment openjpa.test.zip [ 12440004 ]
        Hide
        Fay Wang added a comment -

        You might want to set the property openjpa.jdbc.QuerySQLCache to false and try again.

        Show
        Fay Wang added a comment - You might want to set the property openjpa.jdbc.QuerySQLCache to false and try again.
        Hide
        Kelvin Law added a comment -

        Thanks Fay, it does resolve the issue after setting "openjpa.jdbc.QuerySQLCache" to "false".
        However, sorry I am quite new to OpenJPA and would like to understand more.
        Would you please explain why we need to set this property to false to fix this issue?
        Thanks

        Show
        Kelvin Law added a comment - Thanks Fay, it does resolve the issue after setting "openjpa.jdbc.QuerySQLCache" to "false". However, sorry I am quite new to OpenJPA and would like to understand more. Would you please explain why we need to set this property to false to fix this issue? Thanks
        Kelvin Law made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Not A Problem [ 8 ]
        Hide
        Fay Wang added a comment -

        Hi Kelvin,
        The cache design for openjpa 1.2 has problems. This area is overhauled in the openjpa 2.x code base. You might want to try openjpa 2.x or trunk level code.

        Show
        Fay Wang added a comment - Hi Kelvin, The cache design for openjpa 1.2 has problems. This area is overhauled in the openjpa 2.x code base. You might want to try openjpa 2.x or trunk level code.

          People

          • Assignee:
            Unassigned
            Reporter:
            Kelvin Law
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development