OpenJPA
  1. OpenJPA
  2. OPENJPA-207

failure when composite ID has another composite ID as a field

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.6
    • Fix Version/s: 2.0.0-M2
    • Component/s: None
    • Labels:
      None
    • Environment:
      derby
      jdk 1.5.0_07

      Description

      see attached test case: entities Library, Book, and Page. there is a one-many bidirectional relationship between Library and Book, and Book and Page. a Library's ID is simply it's name. a Book's ID is it's name, plus it's owning library's ID. A Page's ID is it's number, plus it's owning Book's ID.

      this arrangement results in composite IDs for Book and Page. and moreover, Page's composite ID, PageId, contains a page number field plus a BookId. however, this arrangement results in an exception at runtime w/ the included test case ...

      ...
      Caused by: java.lang.ClassCastException: org.apache.openjpa.util.ObjectId
      at com.mycompany.book.Page.pcCopyKeyFieldsToObjectId(Page.java)
      at org.apache.openjpa.util.ApplicationIds.create(ApplicationIds.java:383)
      at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2349)

      note that if i remove the bookId field from PageId, the test case succeeds.

      also note that this problem is also observed against a trunk field from march 3 (0.9.7 snapshot).

      1. book.zip
        33 kB
        Jeffrey Blattman

        Activity

        Jeffrey Blattman created issue -
        Jeffrey Blattman made changes -
        Field Original Value New Value
        Attachment book.zip [ 12355106 ]
        Jeffrey Blattman made changes -
        Summary failure when composite ID w/ another composite ID as a field failure when composite ID has another composite ID as a field
        Pinaki Poddar made changes -
        Assignee Pinaki Poddar [ ppoddar@apache.org ]
        Pinaki Poddar made changes -
        Priority Minor [ 4 ] Major [ 3 ]
        Pinaki Poddar made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0.0 [ 12313483 ]
        Donald Woods made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Pinaki Poddar
            Reporter:
            Jeffrey Blattman
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development