Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.persistence.Entity;
- import javax.persistence.GeneratedValue;
- import javax.persistence.GenerationType;
- import javax.persistence.Id;
- import javax.persistence.ManyToOne;
- import javax.validation.constraints.NotNull;
- @Entity
- public class Book {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
- @NotNull
- private String title;
- @NotNull
- private Integer publicationYear;
- @ManyToOne
- @NotNull
- private Author author;
- // Getters e Setters
- 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 Integer getPublicationYear() {
- return publicationYear;
- }
- public void setPublicationYear(Integer publicationYear) {
- this.publicationYear = publicationYear;
- }
- public Author getAuthor() {
- return author;
- }
- public void setAuthor(Author author) {
- this.author = author;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement