title: Multiple representations of the same entity are being merged, Detached
body: <p>I have been getting an error while trying to update a list of entities containing persisted entity and detached entity both (newly created entity) into my db using jpa2.0.
  My entity contains internal entities which are giving an error (mentioned in the title) when merging the data:</p>
  
  <pre><code>Class superclass{
      private A a;
      private string name;
  
      //getter setters here...
  }
  
  Class A{
      private long id;
      @onetoone(cascade=CascadeType.All, fetch=FetchType.Eager)
       private B b;
      @onetoone(cascade=CascadeType.All, fetch=FetchType.Eager)
      private C c;
  
      //getter setters here...
  
  }
  
  
  Class Dao{
  
      daoInsert(superclass x){
  
      em.merge(x);
  
         }
  }
  </code></pre>
  
  <p>I want any entity sent for persisting to be merged into the db.</p>
  
  <p>Hibernate does provide solution for this by adding the following to the persistence.xml</p>
  
  <p></p>
  
  <p>Is there something I can do in jpa same as hibernate.</p>
  
  <p>Please do not suggest to find the entity using em.find() and then update manually because I need both entities the persisted entity and the newly created entity too. 
  Also I'm using spring form to persist the entire patent entity into db.</p>
  
  <p>I am sorry if I'm not clear enough, this is my first question and I'm really a beginner.</p>
  
  <p>Any help will be most appreciated.</p>