title: Neo4j SDN - OGM nodes equality
body: <p>I have a problem with Spring Data Neo4j and OGM. When I create a node for first time, it`s ok but if I refresh that page I get this error:</p>
  
  <blockquote>
    <p>Cypher execution failed with code 'Neo.ClientError.Schema.ConstraintValidationFailed': Node(126) already exists with label <code>Country</code> and property <code>name</code> = 'Country-1'.</p>
  </blockquote>
  
  <p>I searched the web and read so many documents about <code>equals</code> and <code>hashCode</code> but none of them is helping. Here are my classes:</p>
  
  <pre><code>public abstract class Place {
  
      @Id
      @GeneratedValue(strategy = UuidStrategy.class)
      private String id ;
  
      private String name ;
  
      public String getId(){return id ;}
  
  }
  
  @Getter
  @Setter
  @NodeEntity(label = "Country")
  @CompositeIndex(unique = true , properties = "name")
  public class Country extends Place {
  
      private String label = "Country";
  
      public Country() {}
  
      @Override
      public int hashCode() {
          int result  = label == null ? 1 : label.hashCode();
          result = 31 * result + this.getName() == null ? 0 : this.getName().hashCode();
          result = 31 * result + this.getId() == null ? 0 : this.getId().hashCode();
          return result;
      }
  
      @Override
      public boolean equals(Object o) {
          if (this == o) {
              return true;
          }
          if (!(o instanceof Country)) {
              return false;
          }
          Country that = (Country) o ;
          return this.getName().equals(that.getName())
                  &amp;&amp; this.getId().equals(that.getId())
                  &amp;&amp; this.getLabel().equals(that.getLabel());
      }
  }
  </code></pre>
  
  <p>Repository is default. As I know it`s a problem of equality check but how can I fix this?</p>