main
|
Last change
on this file since 700e2f9 was 700e2f9, checked in by 186079 <matej.milevski@…>, 5 days ago |
|
Init
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | package com.finki.icare.model;
|
|---|
| 2 |
|
|---|
| 3 | import com.fasterxml.jackson.annotation.JsonIgnore;
|
|---|
| 4 | import jakarta.persistence.*;
|
|---|
| 5 | import lombok.AllArgsConstructor;
|
|---|
| 6 | import lombok.Data;
|
|---|
| 7 | import lombok.NoArgsConstructor;
|
|---|
| 8 |
|
|---|
| 9 | import java.time.OffsetDateTime;
|
|---|
| 10 | import java.util.List;
|
|---|
| 11 |
|
|---|
| 12 | @Entity
|
|---|
| 13 | @Table(name = "blog")
|
|---|
| 14 | @Data
|
|---|
| 15 | @NoArgsConstructor
|
|---|
| 16 | @AllArgsConstructor
|
|---|
| 17 | public class Blog {
|
|---|
| 18 |
|
|---|
| 19 | @Id
|
|---|
| 20 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
|---|
| 21 | @Column(name = "id_blog")
|
|---|
| 22 | private Integer idBlog;
|
|---|
| 23 |
|
|---|
| 24 | @ManyToOne
|
|---|
| 25 | @JoinColumn(name = "id_patient", nullable = false)
|
|---|
| 26 | private Patient patient;
|
|---|
| 27 |
|
|---|
| 28 | @Column(name = "content", nullable = false, columnDefinition = "TEXT")
|
|---|
| 29 | private String content;
|
|---|
| 30 |
|
|---|
| 31 | @Column(name = "title", nullable = false, length = 200)
|
|---|
| 32 | private String title;
|
|---|
| 33 |
|
|---|
| 34 | @Column(name = "date_of_post", nullable = false)
|
|---|
| 35 | private OffsetDateTime dateOfPost;
|
|---|
| 36 |
|
|---|
| 37 | @JsonIgnore
|
|---|
| 38 | @OneToMany(mappedBy = "blog", cascade = CascadeType.ALL)
|
|---|
| 39 | private List<Comment> comments;
|
|---|
| 40 |
|
|---|
| 41 | @JsonIgnore
|
|---|
| 42 | @ManyToMany(mappedBy = "likedBlogs")
|
|---|
| 43 | private List<Patient> likedBy;
|
|---|
| 44 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.