OpenJPA
  1. OpenJPA
  2. OPENJPA-1508

ArrayIndexOutOfBoundsException being thrown from ClassMetaData.getExtraFieldDataIndex()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.2.2
    • Fix Version/s: 2.1.0
    • Component/s: jdbc
    • Labels:
      None
    • Environment:
      found this on DB2, but I imagine it doesn't matter

      Description

      An ArrayIndexOutOfBoundsException is being thrown by ClassMetaData.getExtraFieldDataIndex()

      I am providing a test case. The only thing special is that the entities are set up in a hexagon shape, where the entities above have a OneToMany relationship with those below. The one at the very bottom has ManyToOne relationships with the two entities above it and I think this seems to be the cause of the problem.

      I have done some debugging on this and here is where I have gotten to:

      The problem is somewhere around the JDBCStoreManager.initializeState method

      first time through, the mapping object is org.apache.openjpa.persistence.jdbc.query.HexagonBottom and the mappedByFieldMapping is
      org.apache.openjpa.persistence.jdbc.query.HexagonBottom.lowerLeftId (looks good), index is 6
      second time through, the mapping object is org.apache.openjpa.persistence.jdbc.query.HexagonLowerRight and the mappedByFieldMapping is still org.apache.openjpa.persistence.jdbc.query.HexagonBottom.lowerLeftId, so the index is still 6, but the HexagonLowerRight object only has 4 fields in it so the exception is thrown.

      1. tc.zip
        16 kB
        B.J. Reed

        Activity

        Hide
        B.J. Reed added a comment -

        has the test case to demonstrate the exception.

        Show
        B.J. Reed added a comment - has the test case to demonstrate the exception.
        Hide
        B.J. Reed added a comment -

        Forgot to mention that one work around we found for this problem is that if both Lower entities use LAZY fetches in stead of EAGER fetches, then the exception won't be thrown.

        Show
        B.J. Reed added a comment - Forgot to mention that one work around we found for this problem is that if both Lower entities use LAZY fetches in stead of EAGER fetches, then the exception won't be thrown.
        Hide
        Michael Dick added a comment -

        Appears to be fixed by OPENJPA-1424

        Show
        Michael Dick added a comment - Appears to be fixed by OPENJPA-1424

          People

          • Assignee:
            Unassigned
            Reporter:
            B.J. Reed
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development