OpenJPA
  1. OpenJPA
  2. OPENJPA-1571

The change in the element collection is not persisted to the database during merging a detached entity

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-beta2
    • Fix Version/s: 2.0.0-beta3
    • Component/s: None
    • Labels:
      None

      Description

      Given an entity:

      @Entity
      public class EntityB

      { @Id private int id; @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "setIntegerTable", joinColumns = @JoinColumn(name = "parent_id")) @Column(name = "value") private Set<Integer> intVals; ... }

      The following test scenario

      EntityB b1 = em.find(EntityB.class, id);
      em.clear();
      b1.getIntVals().remove(new Integer(1));
      b1.getIntVals().add(new Integer(2));

      em.getTransaction().begin();
      EntityB b2 = em.merge(b1);
      em.getTransaction().commit();
      em.clear();

      EntityB b3 = em.find(EntityB.class, id);
      Set<Integer> intVals = b3.getIntVals();
      ==> this intVals still only contains Integer(1), not Integer(2).

        Issue Links

          Activity

          Hide
          Donald Woods added a comment -

          This is the new behavior as implemented in OPENJPA-1097, in that the EM.clear() was not removing all $proxy classes, which caused them to be included when serialized.

          Show
          Donald Woods added a comment - This is the new behavior as implemented in OPENJPA-1097 , in that the EM.clear() was not removing all $proxy classes, which caused them to be included when serialized.
          Hide
          Donald Woods added a comment -

          Fixed by r925416 checked in using OPENJPA-1097.

          Show
          Donald Woods added a comment - Fixed by r925416 checked in using OPENJPA-1097 .
          Hide
          Thomas O Rowe added a comment -

          Fix verified on Linux AMD64 SE6 with Derby running JSE, web, and EJB scenarios.

          Show
          Thomas O Rowe added a comment - Fix verified on Linux AMD64 SE6 with Derby running JSE, web, and EJB scenarios.

            People

            • Assignee:
              Donald Woods
              Reporter:
              Fay Wang
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development