OpenJPA
  1. OpenJPA
  2. OPENJPA-527

Merge of new one-to-many list only persists last element.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.0.2
    • Fix Version/s: 1.0.3
    • Component/s: None
    • Labels:
      None

      Description

      If a transient new object is merged containing a one-to-many (with elementjoincolumn) list of transient new objects the last object in the list is the only object persisted. This functionality has changed since 1.0.1 as the same code worked properly with that version.

      Calling persist using an equivalent object works properly but this should work in both cases.

      I'll attach a tgz of a maven project that illustrates the problem. The project uses hsqldb internally and should run stand alone without anything but maven and java installed.

      1. mergetest.tgz
        2 kB
        Gil Markham
      2. mergetest.tgz
        2 kB
        Gil Markham

        Activity

        Hide
        Gil Markham added a comment -

        This tgz file contains a standalone maven project that illustrates the problem. You should be able to simply run 'mvn test' to run the failing junit test case against an embedded hsql database. SQL logging is turned on in the persistence.xml to show that only one INSERT is run against table 'B' even though three objects should be persisted.

        Show
        Gil Markham added a comment - This tgz file contains a standalone maven project that illustrates the problem. You should be able to simply run 'mvn test' to run the failing junit test case against an embedded hsql database. SQL logging is turned on in the persistence.xml to show that only one INSERT is run against table 'B' even though three objects should be persisted.
        Hide
        Gil Markham added a comment -

        This tgz file contains a standalone maven project that illustrates the problem. You should be able to simply run 'mvn test' to run the failing junit test case against an embedded hsql database. SQL logging is turned on in the persistence.xml to show that only one INSERT is run against table 'B' even though three objects should be persisted.

        Show
        Gil Markham added a comment - This tgz file contains a standalone maven project that illustrates the problem. You should be able to simply run 'mvn test' to run the failing junit test case against an embedded hsql database. SQL logging is turned on in the persistence.xml to show that only one INSERT is run against table 'B' even though three objects should be persisted.
        Hide
        Pinaki Poddar added a comment -

        The attached test passes with 1.2.0-SNAPSHOT.

        Show
        Pinaki Poddar added a comment - The attached test passes with 1.2.0-SNAPSHOT.

          People

          • Assignee:
            Pinaki Poddar
            Reporter:
            Gil Markham
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development