| package com.pt.entity; |
| |
| import jakarta.persistence.Entity; |
| import jakarta.persistence.GeneratedValue; |
| import jakarta.persistence.GenerationType; |
| import jakarta.persistence.Id; |
| |
| import java.time.LocalDate; |
| |
| @Entity |
| public class Post { |
| |
| @Id |
| @GeneratedValue(strategy = GenerationType.IDENTITY) |
| private int pid; |
| |
| private String title; |
| private String content; |
| private String author; |
| private LocalDate publishDate; |
| |
| public Post() { |
| } |
| |
| public Post(String title, String content, String author) { |
| this.title = title; |
| this.content = content; |
| this.author = author; |
| this.publishDate = LocalDate.now(); |
| } |
| |
| public int getPid() { |
| return pid; |
| } |
| |
| public void setPid(int pid) { |
| this.pid = pid; |
| } |
| |
| public String getTitle() { |
| return title; |
| } |
| |
| public void setTitle(String title) { |
| this.title = title; |
| } |
| |
| public String getContent() { |
| return content; |
| } |
| |
| public void setContent(String content) { |
| this.content = content; |
| } |
| |
| public String getAuthor() { |
| return author; |
| } |
| |
| public void setAuthor(String author) { |
| this.author = author; |
| } |
| |
| public LocalDate getPublishDate() { |
| return publishDate; |
| } |
| |
| public void setPublishDate(LocalDate publishDate) { |
| this.publishDate = publishDate; |
| } |
| } |