OpenJPA
  1. OpenJPA
  2. OPENJPA-1109

Entry get lost when attachCollection

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 1.2.1
    • Fix Version/s: None
    • Component/s: kernel
    • Labels:
      None
    • Environment:
      N/A

      Description

      This has been a problem when merge a parent object, the parent object has a set with child as entry. The child object equals() method are rely on child.key property.
      In some case, the parent.children set was attached before the child.key property was attached. Then only one entry will be in the set since the children are equals() with child.key=null.

      Possible solution: Move collection to be process last while attach an object. This give a chance for all other single property been attached, so it won't break the equals() logic.

        Activity

        Hide
        Jim Guo added a comment -

        A simple test case,
        Add two OrderSku in the OrderShipment.skus set, after merge, only one entry returned in the set.
        But all db was populated correctly and if we do a load, the set will be build up correctly.

        Show
        Jim Guo added a comment - A simple test case, Add two OrderSku in the OrderShipment.skus set, after merge, only one entry returned in the set. But all db was populated correctly and if we do a load, the set will be build up correctly.
        Hide
        Jim Guo added a comment - - edited

        I can provide a patch if push the collection last is acceptable.
        And also want to know if we have other better solutions.

        Show
        Jim Guo added a comment - - edited I can provide a patch if push the collection last is acceptable. And also want to know if we have other better solutions.

          People

          • Assignee:
            Unassigned
            Reporter:
            Jim Guo
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development