Matthias Andreas Benkard | 4982faa | 2021-02-24 06:45:39 +0100 | [diff] [blame^] | 1 | package eu.mulk.demos.blog; |
| 2 | |
| 3 | import io.quarkus.hibernate.orm.panache.PanacheEntity; |
| 4 | import java.time.Instant; |
| 5 | import java.util.List; |
| 6 | import javax.persistence.Column; |
| 7 | import javax.persistence.Entity; |
| 8 | import javax.persistence.FetchType; |
| 9 | import javax.persistence.ManyToMany; |
| 10 | import javax.persistence.ManyToOne; |
| 11 | import javax.persistence.OneToMany; |
| 12 | |
| 13 | @Entity |
| 14 | public class Post extends PanacheEntity { |
| 15 | |
| 16 | public String title; |
| 17 | |
| 18 | public Instant publicationDate; |
| 19 | |
| 20 | @Column(columnDefinition = "TEXT") |
| 21 | public String body; |
| 22 | |
| 23 | @ManyToOne(fetch = FetchType.LAZY) |
| 24 | public Author author; |
| 25 | |
| 26 | @ManyToMany(fetch = FetchType.LAZY) |
| 27 | public List<Category> categories; |
| 28 | |
| 29 | @OneToMany(fetch = FetchType.LAZY) |
| 30 | public List<Comment> comments; |
| 31 | } |