Advertisement
joaopaulofcc

Untitled

Nov 21st, 2023
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. import javax.persistence.Entity;
  2. import javax.persistence.GeneratedValue;
  3. import javax.persistence.GenerationType;
  4. import javax.persistence.Id;
  5. import javax.persistence.ManyToOne;
  6. import javax.validation.constraints.NotNull;
  7.  
  8. @Entity
  9. public class Book {
  10. @Id
  11. @GeneratedValue(strategy = GenerationType.IDENTITY)
  12. private Long id;
  13.  
  14. @NotNull
  15. private String title;
  16.  
  17. @NotNull
  18. private Integer publicationYear;
  19.  
  20. @ManyToOne
  21. @NotNull
  22. private Author author;
  23.  
  24. // Getters e Setters
  25. public Long getId() {
  26. return id;
  27. }
  28.  
  29. public void setId(Long id) {
  30. this.id = id;
  31. }
  32.  
  33. public String getTitle() {
  34. return title;
  35. }
  36.  
  37. public void setTitle(String title) {
  38. this.title = title;
  39. }
  40.  
  41. public Integer getPublicationYear() {
  42. return publicationYear;
  43. }
  44.  
  45. public void setPublicationYear(Integer publicationYear) {
  46. this.publicationYear = publicationYear;
  47. }
  48.  
  49. public Author getAuthor() {
  50. return author;
  51. }
  52.  
  53. public void setAuthor(Author author) {
  54. this.author = author;
  55. }
  56. }
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement