title: Should I write equals() and hashCode() methods in JPA entities?
body: <p>I want to check if entity is in a Collection member (<code>@OneToMany</code> or <code>@ManyToMany</code>) of another entity:</p>
  
  <pre><code>if (entity2.getEntities1().contains(entity1)) { }
  </code></pre>