title: Under what circumstances could this weird jpa behaviour happen?
body: <p>I have a stateless ejb bean with an entitymanager (em) and this function.</p>
  
  <pre><code>public void what(Long commentId) {
      Comment c = em.find(Comment.class, commentId);
      em.refresh(c);
      CommentUpdate cu = new CommentUpdate(c, "new Text");
      em.persist(cu);
      c.getUpdates().add(0, cu);
      int i = c.getUpdates().size();
      em.flush();
      int j = c.getUpdates().size();
      if (i != j)
          System.err.println("What?");
  }
  </code></pre>
  
  <p>CommentUpdate is a pretty simple entity classes.</p>
  
  <pre><code>@Entity
  @NoArgsConstructor(access = AccessLevel.PROTECTED)
  public class CommentUpdate extends AbstractEntity {
  
  @ManyToOne
  @Getter
  @Setter
  private Comment comment;
  
  @Getter
  @Setter
  private String text;
  
  public CommentUpdate(Comment comment, String text) {
      this.comment = comment;
      this.text = text;
  }
  }
  </code></pre>
  
  <p>Comment is slightly more complex but having the relation defined like this:</p>
  
  <pre><code>@OneToMany(mappedBy = "comment")
  @OrderBy("createdAt DESC")
  @Getter
  private List&lt;CommentUpdate&gt; updates = new ArrayList&lt;&gt;();
  </code></pre>
  
  <p>The thing is now, that sometimes "What?" is printed to the log.
  The newly created CommentUpdate is vanished after the flush. but is back on the next refresh. 
  It is a method in a larger vaadin project and I was not yet able to reproduce this in a small/simple project. Is there a situation where this is logical behaviour or might this be a bug in eclipselink (2.6) used by glassfish (4.1.1)?</p>