title: JPA 2.0 Eclipselink - Adding/Deleting to child list gets optimistic lock
body: <p>I am having an issue where eclipselink (2.5) is throwing an OptimisticLockException even though the only thing I'm modifiying is trying to either add or remove an item from a child list. </p>
  
  <p>Entities : </p>
  
  <pre><code>  @Entity
      @Table(name="PLAN_ORG_RELATIONSHIP")
      @Customizer(GridCacheCustomizer.class)
      @AdditionalCriteria("CURRENT_TIMESTAMP BETWEEN this.startDate AND this.endDate")
      @NamedQuery(name="PlanOrganizationRelationship.findAll", query="SELECT p FROM PlanOrganizationRelationship p")
      @Portable
      public class PlanOrganizationRelationship extends PrismObject implements Serializable {
  
      @OneToMany(mappedBy="planOrganizationRelationship", cascade=CascadeType.PERSIST,    orphanRemoval=true) 
      @PortableProperty(10)
      private List&lt;PlanOrganizationAction&gt; planOrganizationActions;
  
  public PlanOrganizationAction addPlanOrganizationAction(PlanOrganizationAction planOrganizationAction) {
          getPlanOrganizationActions().add(planOrganizationAction);
          planOrganizationAction.setPlanOrgRelationship(this);
          return planOrganizationAction;
      }
  
      public PlanOrganizationAction removePlanOrganizationAction(PlanOrganizationAction planOrganizationAction) {
          getPlanOrganizationActions().remove(planOrganizationAction);
          planOrganizationAction.setPlanOrgRelationship(null);
          return planOrganizationAction;
      }
  
      @Column(name="LST_UPDT_DT")
      @Version
      @PortableProperty(5)
      private Timestamp lastUpdatedDate;
  }
  </code></pre>
  
  <p>Other side of One To Many:</p>
  
  <pre><code>@Entity
  @Table(name="PLAN_ORGANIZATION_ACTION")
  @Customizer(GridCacheCustomizer.class)
  @AdditionalCriteria("CURRENT_TIMESTAMP BETWEEN this.startDate AND this.endDate")
  @NamedQuery(name="PlanOrganizationAction.findAll", query="SELECT p FROM PlanOrganizationAction p")
  @Portable
  public class PlanOrganizationAction extends PrismObject implements Serializable {
  @ManyToOne
      @JoinColumn(name="PLN_ORG_RLTNP_SEQ_ID")
      @PortableProperty(7)
      private PlanOrganizationRelationship planOrganizationRelationship;
  }
  </code></pre>
  
  <p>I have 3 paths - Adding new Relationship with Actions (both entities new) or Add an Action or Remove Action</p>
  
  <p>When I am adding both, I perist the parent and the children are persisted as well and that is the expected behavior.
  When I try to add or remove I try something like</p>
  
  <pre><code>PrismOrganizationRelationship por = findById (..) //we are spring-data-jpa
  por.addPlanOrganizationAction(action);
  repo.save(por); // Throws optimistic lock - even though @Version is the same 
  </code></pre>
  
  <p>Not sure what is causing this issue ?</p>