title: Is mutable ID safe with Hibernate and Ehcache?
body: <p>Is it safe to use a mutable ID with Hibernate and Ehcache? Also note that <code>hashCode</code> is based on the ID.</p>
  
  <pre><code>class Company implements Serializable {
    String code; // PK
    public int hashCode() {
      return code == null ? 17 : code.hashCode();
    }
    public boolean equals(Object o) {
      // Some obvious equals checking for type and field equality
    }
  }
  </code></pre>