Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. package bookrental.model.book;
  2.  
  3. import com.fasterxml.jackson.annotation.JsonIgnore;
  4. import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  5. import com.fasterxml.jackson.annotation.JsonView;
  6. import lombok.*;
  7.  
  8. import javax.persistence.*;
  9. import javax.validation.constraints.NotNull;
  10.  
  11. @Entity
  12. @Getter
  13. @Setter
  14. @EqualsAndHashCode
  15. @AllArgsConstructor
  16. @NoArgsConstructor
  17. public class Book {
  18.  
  19.     @Id
  20.     @GeneratedValue(strategy = GenerationType.AUTO)
  21.     private int id;
  22.     @NotNull
  23.     private String title;
  24.     @NotNull
  25.     private String author;
  26.     @NotNull
  27.     private String category;
  28.     private boolean available;
  29.  
  30.     public Book(String title, String author, String category, boolean available) {
  31.         this.title = title;
  32.         this.author = author;
  33.         this.category = category;
  34.         this.available = available;
  35.     }
  36.  
  37.     public Book(int bookID) {
  38.         this.id = bookID;
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement