title: Remove then Query fails in JPA (deleted entity passed to persist)
body: <p>I have two entitys MobeeCustomer and CustomerRegion i want to remove the object from CustomerRegion first Im put join Coloumn in CustomerRegion is null then  Remove the Object
  from the entityManager but Iam getting Exception</p>
  
  <p>MobeeCustomer:</p>
  
  <blockquote>
  <pre><code>  public class MobeeCustomer implements Serialization{
  
    private Long id;
  
    private String custName;
  
    private String Address;
  
    private String phoneNo; 
  
    private Set&lt;CustomerRegion&gt; customerRegion = new HashSet&lt;CustomerRegion&gt;(0);
  
  
    @OneToMany(cascade = { CascadeType.PERSIST, CascadeType.REMOVE },
     fetch =    FetchType.LAZY, mappedBy = "mobeeCustomer")     
     public Set&lt;CustomerRegion&gt; getCustomerRegion() { 
      return CustomerRegion;  
       }
  
    public void setCustomerRegion(Set&lt;CustomerRegion&gt; customerRegion) {
        CustomerRegion = customerRegion;    
      }
  
    }
  </code></pre>
  </blockquote>
  
  <p>CustomerRegion</p>
  
  <pre><code>  public class CustomerRegion implements Serializable{
  
  private Long id;
  
  private String custName;
  
  private String description;
  
  private String createdBy;
  private Date createdOn;
  
  private String updatedBy;
  private Date updatedOn;
     private MobeeCustomer mobeeCustomer;
  
  
  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "MOBEE_CUSTOMER")
  public MobeeCustomer getMobeeCustomer() {
      return mobeeCustomer;
  }
  public void setMobeeCustomer(MobeeCustomer mobeeCustomer) {
      this.mobeeCustomer = mobeeCustomer;
  }
  
  
     }
  </code></pre>
  
  <p>sample code:</p>
  
  <pre><code>   if (doUpdateRegion.getStatus().equals(UserOperations.DELETE.getType())) {
  
  custEntity = getEntityManager().find(CustomerRegion.class,doUpdateRegion.getId());
  
  
        BeanUtils.copyProperties(custEntity, doUpdateRegion);
  
  deletedRegionsList.add(custEntity);
  
  
  
  }
  
  
    for (CustomerRegion region : deletedRegionList) {
  
  
              region.setMobeeCustomer(null);
        getEntityManager().remove(region);
  }
  
  
  
  
  
  
  
  StackTrace:
  
  please suggest me how to remove the CustomerRegion Object I  am getting Exception
  
    javax.persistence.EntityNotFoundException: deleted entity passed to persist:          [com.manam.mobee.persist.entity.CustomerRegion#&lt;null&gt;]
  15:46:34,614 ERROR [STDERR]     at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:613)
  15:46:34,614 ERROR [STDERR]     at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:299)
  15:46:34,614 ERROR [STDERR]     at org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProxy.java:92)
  15:46:34,614 ERROR [STDERR]     at org.jboss.seam.framework.EntityHome.update(EntityHome.java:64)
  </code></pre>