Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.app.domain; /** * * @author rohat */ import java.util.Objects; import org.springframework.data.annotation.Id; public class Book { @Id private String id; private String bookname; private String author; public Book() { } public Book(String bookname, String author) { this.bookname = bookname; this.author = author; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getBookname() { return bookname; } public void setBookname(String bookname) { this.bookname = bookname; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } @Override public String toString() { return "Book{" + "id=" + id + ", bookname=" + bookname + ", author=" + author + '}'; } @Override public int hashCode() { int hash = 5; hash = 59 * hash + Objects.hashCode(this.id); hash = 59 * hash + Objects.hashCode(this.bookname); hash = 59 * hash + Objects.hashCode(this.author); return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Book other = (Book) obj; if (!Objects.equals(this.id, other.id)) { return false; } if (!Objects.equals(this.bookname, other.bookname)) { return false; } if (!Objects.equals(this.author, other.author)) { return false; } return true; } }