Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-1571

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-beta2
    • 2.0.0-beta3
    • None
    • 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).

      Attachments

        Issue Links

          Activity

            People

              drwoods Donald Woods
              faywang Fay Wang
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: