title: Null object if entity not found
body: <p>I'm working with Hibernate and JPA. I have an entity called <code>Customer</code> that references a <code>ParentCustomer</code>:</p>
  
  <pre><code>public class Customer {
      @Id
      @GeneratedValue
      @Column(name = "CustomerID")
      private int id;
  
      @ManyToOne
      @JoinColumn(name = "ParentCustomerID")
      private Customer parent;
  
      // ...
  }
  </code></pre>
  
  <p>But in my db there are some customers that have no parent so the <code>ParentCustomerID</code> is set to <code>0</code>. The exception I get when I test my class is:</p>
  
  <p><code>javax.persistence.EntityNotFoundException: Unable to find it.keyforup.pat.data.entities.Customer with id 0</code></p>
  
  <p>Is there a way to set the <code>ParentCustomer</code> to <code>null</code> when id is <code>0</code>?</p>