content: package com.example.demo.domain;
  
  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  import io.swagger.v3.oas.annotations.media.Schema;
  import java.io.Serializable;
  import java.util.HashSet;
  import java.util.Set;
  import javax.persistence.*;
  import org.hibernate.annotations.Cache;
  import org.hibernate.annotations.CacheConcurrencyStrategy;
  
  /**
   * Task entity.\n@author The JHipster team.
   */
  @Schema(description = "Task entity.\n@author The JHipster team.")
  @Entity
  @Table(name = "task")
  @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
  public class Task implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name = "id")
      private Long id;
  
      @Column(name = "title")
      private String title;
  
      @Column(name = "description")
      private String description;
  
      @ManyToMany(mappedBy = "tasks")
      @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
      @JsonIgnoreProperties(value = { "tasks", "employee" }, allowSetters = true)
      private Set<Job> jobs = new HashSet<>();
  
      // jhipster-needle-entity-add-field - JHipster will add fields here
  
      public Long getId() {
          return this.id;
      }
  
      public Task id(Long id) {
          this.setId(id);
          return this;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public String getTitle() {
          return this.title;
      }
  
      public Task title(String title) {
          this.setTitle(title);
          return this;
      }
  
      public void setTitle(String title) {
          this.title = title;
      }
  
      public String getDescription() {
          return this.description;
      }
  
      public Task description(String description) {
          this.setDescription(description);
          return this;
      }
  
      public void setDescription(String description) {
          this.description = description;
      }
  
      public Set<Job> getJobs() {
          return this.jobs;
      }
  
      public void setJobs(Set<Job> jobs) {
          if (this.jobs != null) {
              this.jobs.forEach(i -> i.removeTask(this));
          }
          if (jobs != null) {
              jobs.forEach(i -> i.addTask(this));
          }
          this.jobs = jobs;
      }
  
      public Task jobs(Set<Job> jobs) {
          this.setJobs(jobs);
          return this;
      }
  
      public Task addJob(Job job) {
          this.jobs.add(job);
          job.getTasks().add(this);
          return this;
      }
  
      public Task removeJob(Job job) {
          this.jobs.remove(job);
          job.getTasks().remove(this);
          return this;
      }
  
      // 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 Task)) {
              return false;
          }
          return id != null && id.equals(((Task) 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 "Task{" +
              "id=" + getId() +
              ", title='" + getTitle() + "'" +
              ", description='" + getDescription() + "'" +
              "}";
      }
  }
  