aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/data/entities/ReplyEntity.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2024-07-01 04:10:37 +0300
committerGravatar Vitaly Takmazov2024-07-01 04:10:37 +0300
commit9436d4927dc5035c83620bdd1dd34600370dce56 (patch)
tree2443779dddd23288e0f71b852293d736cf5db942 /src/main/java/com/juick/data/entities/ReplyEntity.java
parent9e2e2732d67ba0088b56804f7193e95b4ae46f22 (diff)
JPA: fix relations, add new fields, add basic tests
Diffstat (limited to 'src/main/java/com/juick/data/entities/ReplyEntity.java')
-rw-r--r--src/main/java/com/juick/data/entities/ReplyEntity.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/main/java/com/juick/data/entities/ReplyEntity.java b/src/main/java/com/juick/data/entities/ReplyEntity.java
index e7f3d053..bc0795cf 100644
--- a/src/main/java/com/juick/data/entities/ReplyEntity.java
+++ b/src/main/java/com/juick/data/entities/ReplyEntity.java
@@ -24,11 +24,12 @@ import jakarta.persistence.*;
public class ReplyEntity extends BaseMessagePropertyEntity {
@Id
@Column(name = "reply_id")
- @GeneratedValue(strategy = GenerationType.AUTO)
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long replyId;
@Column(name = "txt")
- private
- String text;
+ private String text;
+ @ManyToOne(cascade = CascadeType.MERGE)
+ private UserEntity user;
public String getText() {
return text;
@@ -45,4 +46,12 @@ public class ReplyEntity extends BaseMessagePropertyEntity {
public void setReplyId(Long replyId) {
this.replyId = replyId;
}
+
+ public UserEntity getUser() {
+ return user;
+ }
+
+ public void setUser(UserEntity user) {
+ this.user = user;
+ }
}