Add Publication abstract class for inheritance in content models
This commit is contained in:
@@ -0,0 +1,65 @@
|
|||||||
|
package com.humanbooster.model;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||||
|
@DiscriminatorColumn
|
||||||
|
public abstract class Publication {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Column(nullable = false, length = 200)
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@Column(nullable = false)
|
||||||
|
private LocalDate publishDate;
|
||||||
|
|
||||||
|
public Publication() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Publication(String title, String content, LocalDate publishDate) {
|
||||||
|
this.title = title;
|
||||||
|
this.content = content;
|
||||||
|
this.publishDate = publishDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getPublishDate() {
|
||||||
|
return publishDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPublishDate(LocalDate publishDate) {
|
||||||
|
this.publishDate = publishDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user