Guest User

Untitled

a guest
Dec 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.91 KB | None | 0 0
  1. package pl.szczerbakowski.magenta.model.entities;
  2.  
  3. import java.io.Serializable;
  4. import java.util.Date;
  5. import java.util.List;
  6.  
  7. import javax.persistence.Column;
  8. import javax.persistence.FetchType;
  9. import javax.persistence.GeneratedValue;
  10. import javax.persistence.GenerationType;
  11. import javax.persistence.Id;
  12. import javax.persistence.JoinColumn;
  13. import javax.persistence.ManyToOne;
  14. import javax.persistence.OneToMany;
  15. import javax.persistence.SequenceGenerator;
  16. import javax.persistence.Table;
  17. import javax.persistence.Transient;
  18. import javax.validation.constraints.NotNull;
  19. import javax.validation.constraints.Size;
  20. import javax.persistence.Entity;
  21.  
  22. @Entity
  23. @Table(name = "ARTICLE")
  24. @SequenceGenerator(sequenceName = "ArticleSeq", name = "ArticleSeqGen")
  25. public class Article implements Serializable {
  26.  
  27.     @Id
  28.     @GeneratedValue(generator = "ArticleSeqGen", strategy = GenerationType.SEQUENCE)
  29.     private long id;
  30.     // private String author;
  31.  
  32.     @Column(name = "title")
  33.     private String title;
  34.  
  35.     @ManyToOne(fetch = FetchType.LAZY)
  36.     @JoinColumn(name = "CategoryID", nullable = false)
  37.     private Category category;
  38.  
  39.     @Column(name = "content")
  40.     private String content;
  41.  
  42.     @Column(name = "publicationDate", nullable = false)
  43.     private Date publicationDate;
  44.  
  45.     public long getId() {
  46.         return id;
  47.     }
  48.  
  49.     public void setId(long id) {
  50.         this.id = id;
  51.     }
  52.  
  53.     public String getTitle() {
  54.         return title;
  55.     }
  56.  
  57.     public void setTitle(String title) {
  58.         this.title = title;
  59.     }
  60.  
  61.     public Category getCategory() {
  62.         return category;
  63.     }
  64.  
  65.     public void setCategory(Category category) {
  66.         this.category = category;
  67.     }
  68.  
  69.     public String getContent() {
  70.         return content;
  71.     }
  72.  
  73.     public void setContent(String content) {
  74.         this.content = content;
  75.     }
  76.  
  77.     public Date getPublicationDate() {
  78.         return publicationDate;
  79.     }
  80.  
  81.     public void setPublicationDate(Date publicationDate) {
  82.         this.publicationDate = publicationDate;
  83.     }
  84.  
  85. }
Add Comment
Please, Sign In to add comment