title: After adding @Future annotation to entity - TraversableResolver.isReachable() threw an exception
body: <p>I am using Spring Framework 4 &amp; Hibernate 4.</p>
  
  <p>I added @Future constraint into my entity and after that I am running into Exception:</p>
  
  <pre><code>javax.validation.ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.
  </code></pre>
  
  <p>After some research I found out that it is caused by including <code>id</code> in hashCode method, if I remove the <code>id</code> from hashCode method then the Exception is gone and it works as intended.</p>
  
  <pre><code>@Override
  public int hashCode() {
      int result = id.hashCode();
      // Code intentionally omitted
      return result;
  }
  </code></pre>
  
  <p><strong>Question is</strong>: Why can't I use the <code>id</code> in <code>hashCode</code> method like this? How should I change it?</p>
  
  <p>Entity code: </p>
  
  <pre><code>@Entity
  @Table(name = "ACTIVITY")
  public class ActivityEntity implements Serializable {
      @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name = "ID", nullable = false, length = 10)
      private Long id;
  
      @Temporal(TemporalType.TIMESTAMP)
      @Future
      @Column(name = "ACTIVITY_FROM", nullable = false, length = 19)
      private Date activityFrom;
  
      // Code of other attributes intentionally omitted
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public Date getActivityFrom() {
          return activityFrom;
      }
  
      public void setActivityFrom(Date activityFrom) {
          this.activityFrom = activityFrom;
      }
  
      // Code of other methods intentionally omitted
  
      @Override
      public int hashCode() {
          int result = id.hashCode();
          // Code intentionally omitted
          return result;
      }
  }
  </code></pre>
  
  <p><strong>Solution:</strong></p>
  
  <p>I changed attribute id:</p>
  
  <pre><code>@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Column(name = "ID", length = 10)
  private Long id;
  </code></pre>
  
  <p>I changed hashCode method:</p>
  
  <p><code>int result = id != null ? id.hashCode() : 0;</code></p>