aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/data/entities/MessageEntity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/data/entities/MessageEntity.java')
-rw-r--r--src/main/java/com/juick/data/entities/MessageEntity.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main/java/com/juick/data/entities/MessageEntity.java b/src/main/java/com/juick/data/entities/MessageEntity.java
index 416334d6..21896fb9 100644
--- a/src/main/java/com/juick/data/entities/MessageEntity.java
+++ b/src/main/java/com/juick/data/entities/MessageEntity.java
@@ -30,24 +30,24 @@ public class MessageEntity implements Serializable {
@Column(name = "message_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
- @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "message")
+ @ManyToMany
+ @JoinTable(name = "messages_tags",
+ joinColumns = @JoinColumn(name = "message_id"),
+ inverseJoinColumns = @JoinColumn(name = "tag_id")
+ )
private Set<TagEntity> tags = new HashSet<>();
- @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "message")
- private Set<ReplyEntity> replies = new HashSet<>();
- @OneToOne(cascade = CascadeType.ALL)
- @PrimaryKeyJoinColumn
- private TextEntity textEntity;
+ @OneToMany(mappedBy = "message")
+ private Set<ReplyEntity> replies = new HashSet<>();
- @ManyToOne(cascade = CascadeType.ALL)
+ @ManyToOne(cascade = CascadeType.MERGE)
private UserEntity user;
@Column(name = "ts")
private Instant ts;
- public MessageEntity() {
- this.textEntity = new TextEntity();
- }
+ @Column(name = "txt")
+ private String text;
public Integer getId() {
return id;
@@ -74,11 +74,11 @@ public class MessageEntity implements Serializable {
}
public String getText() {
- return textEntity.getText();
+ return text;
}
public void setText(String text) {
- this.textEntity.setText(text);
+ this.text = text;
}
public UserEntity getUser() {