content: package com.example.demo.domain;
  
  import java.io.Serializable;
  import javax.persistence.*;
  import org.hibernate.annotations.Cache;
  import org.hibernate.annotations.CacheConcurrencyStrategy;
  
  /**
   * A Foo.
   */
  @Entity
  @Table(name = "foo")
  @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
  public class Foo implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name = "id")
      private Long id;
  
      @Column(name = "name")
      private String name;
  
      // jhipster-needle-entity-add-field - JHipster will add fields here
  
      public Long getId() {
          return this.id;
      }
  
      public Foo id(Long id) {
          this.setId(id);
          return this;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public String getName() {
          return this.name;
      }
  
      public Foo name(String name) {
          this.setName(name);
          return this;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
  
      @Override
      public boolean equals(Object o) {
          if (this == o) {
              return true;
          }
          if (!(o instanceof Foo)) {
              return false;
          }
          return id != null && id.equals(((Foo) o).id);
      }
  
      @Override
      public int hashCode() {
          // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
          return getClass().hashCode();
      }
  
      // prettier-ignore
      @Override
      public String toString() {
          return "Foo{" +
              "id=" + getId() +
              ", name='" + getName() + "'" +
              "}";
      }
  }
  