title: Why is persist method called twice?
body: <p>In my service level I create a new object from Entity1 class and persist it and then call setters on it. but after all, another object from Entity1 will be created and inserted in database( so I will have two rows in Entity1 table inserted in database instead of one). MyEntity1 has a <code>many-to-many</code> relationship with itself and I set it after calling persist method.
  My problem is that I can't find why an additional Entity1 object is created in my application.</p>
  
  <p>My service class:</p>
  
  <pre><code>MyEntity1 e1 = new MyEntity1();
  em.persist(e1); 
  MyEntity2 e2 = new MyEntity2();
  e2.setChild(e1);
  e2.setParent(e1);
  e1.getParent().add(e2);
  e1.getChildren().add(e2);
  </code></pre>
  
  <p>MyEntity1 class has two oneToMany relationships with itself (it is a manyToMany relation with additional column):</p>
  
  <p>MyEntity1 class:</p>
  
  <pre><code> @OneToMany(cascade=CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "child", orphanRemoval = true)
      private List&lt;MyEntity2&gt; parent = new ArrayList&lt;MyEntity2&gt;();
  
   @OneToMany(cascade=CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parent")  
      private List&lt;MyEntity2&gt; children= new ArrayList&lt;MyEntity2&gt;();
  </code></pre>