content: package com.bookstore.entity;
  
  import com.fasterxml.jackson.annotation.JsonBackReference;
  
  import javax.persistence.Entity;
  import javax.persistence.FetchType;
  import javax.persistence.Id;
  import javax.persistence.JoinColumn;
  import javax.persistence.ManyToOne;
  import java.io.Serializable;
  
  @Entity
  public class Book implements Serializable {
      private static final long serialVersionUID = 1L;
  
      @Id
      private Long id;
  
      private String title;
      private String isbn;
  
      @ManyToOne(fetch = FetchType.LAZY)
      @JoinColumn(name = "author_id")
      @JsonBackReference
      private Author author;
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public String getTitle() {
          return title;
      }
  
      public void setTitle(String title) {
          this.title = title;
      }
  
      public String getIsbn() {
          return isbn;
      }
  
      public void setIsbn(String isbn) {
          this.isbn = isbn;
      }
  
      public Author getAuthor() {
          return author;
      }
  
      public void setAuthor(Author author) {
          this.author = author;
      }
  
      @Override
      public boolean equals(Object obj) {
          if (obj == null) {
              return false;
          }
          if (this == obj) {
              return true;
          }
          if (!(obj instanceof Book)) {
              return false;
          }
  
          return id != null && id.equals(((Book) obj).id);
      }
  
      @Override
      public int hashCode() {
          return 2021;
      }
  
      @Override
      public String toString() {
          return "Book{" + "id=" + id + ", title=" + title + ", isbn=" + isbn + '}';
      }
  }