Guest User

Untitled

a guest
Jul 21st, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. package com.example.demo;
  2.  
  3. import javax.persistence.*;
  4.  
  5. @Entity
  6. @Table(name = "books")
  7. public class Book {
  8. @Id
  9. @GeneratedValue(strategy = GenerationType.IDENTITY)
  10. private Long id;
  11. private String title;
  12.  
  13. @ManyToOne(cascade = CascadeType.ALL)
  14. @JoinColumn(name = "publisher_id")
  15. private Publisher publisher;
  16.  
  17. @Column(name = "score")
  18. private int rating;
  19.  
  20. private String description;
  21. public Book() {
  22. }
  23.  
  24. public Publisher getPublisher() {
  25. return publisher;
  26. }
  27.  
  28. public void setPublisher(Publisher publisher) {
  29. this.publisher = publisher;
  30. }
  31.  
  32. public Long getId() {
  33. return id;
  34. }
  35.  
  36. public void setId(Long id) {
  37. this.id = id;
  38. }
  39.  
  40. public String getTitle() {
  41. return title;
  42. }
  43.  
  44. public void setTitle(String title) {
  45. this.title = title;
  46. }
  47.  
  48. public int getRating() {
  49. return rating;
  50. }
  51.  
  52. public void setRating(int rating) {
  53. this.rating = rating;
  54. }
  55.  
  56. public String getDescription() {
  57. return description;
  58. }
  59.  
  60. public void setDescription(String description) {
  61. this.description = description;
  62. }
  63. }
Add Comment
Please, Sign In to add comment