title: Immutable Queries
body: <p>Please let me know is overriding equals and hashcode methods are mandatory even if key that I am using is immutable class.</p>
  
  <p>For example I have an immutable class Employee and I want to use as key in a map. Do I need to override equals and hashcode methods.</p>
  
  <pre><code>public class Employee  {
  
      private int empId;
      private String name;
  
      public Employee(String name, int empId) {
  
         this.empId = empId;
         this.name=name;
      }
  
      public int getEmpId() {
         return empId;
      }
      public String getName() {
         return name;
      }
  }
  </code></pre>
  
  <p>Thanks,
  Kamal</p>