main
Last change
on this file since 7fafead was 7fafead, checked in by Test <matonikolov77@…>, 3 years ago |
Resolving models
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | package com.wediscussmovies.project.model;
|
---|
2 |
|
---|
3 | import lombok.Data;
|
---|
4 |
|
---|
5 | import javax.persistence.*;
|
---|
6 | import java.sql.Date;
|
---|
7 | import java.util.Optional;
|
---|
8 |
|
---|
9 | @Entity
|
---|
10 | @Table(name = "replies", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
|
---|
11 | @IdClass(RepliesEntityPK.class)
|
---|
12 | @Data
|
---|
13 | public class Reply {
|
---|
14 | @Id
|
---|
15 | @Column(name = "discussion_id")
|
---|
16 | private Long discussionId;
|
---|
17 |
|
---|
18 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
19 | @Id
|
---|
20 | @Column(name = "reply_id")
|
---|
21 | private Long replyId;
|
---|
22 |
|
---|
23 | private String text;
|
---|
24 |
|
---|
25 | private Date date;
|
---|
26 |
|
---|
27 | @ManyToOne
|
---|
28 | @JoinColumn(name = "discussion_id", referencedColumnName = "discussion_id", nullable = false,insertable = false, updatable = false)
|
---|
29 | private Discussion discussion;
|
---|
30 |
|
---|
31 | @ManyToOne
|
---|
32 | @JoinColumn(name = "user_id")
|
---|
33 | private User user;
|
---|
34 |
|
---|
35 |
|
---|
36 |
|
---|
37 |
|
---|
38 | public Reply(Discussion discussion, User user, Date date, String text) {
|
---|
39 | this.discussion = discussion;
|
---|
40 | this.user = user;
|
---|
41 | this.date = date;
|
---|
42 | this.text = text;
|
---|
43 |
|
---|
44 | }
|
---|
45 |
|
---|
46 | public Reply() {
|
---|
47 |
|
---|
48 | }
|
---|
49 |
|
---|
50 |
|
---|
51 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.