diff --git a/chatto/src/main/java/org/ros/chatto/model/UserSession.java b/chatto/src/main/java/org/ros/chatto/model/UserSession.java index 286fb3a..6263d90 100644 --- a/chatto/src/main/java/org/ros/chatto/model/UserSession.java +++ b/chatto/src/main/java/org/ros/chatto/model/UserSession.java @@ -2,7 +2,9 @@ package org.ros.chatto.model; import java.time.Instant; +import javax.persistence.CascadeType; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @@ -10,8 +12,6 @@ import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Table; -import org.ros.chatto.model.ChatUser; - import lombok.Data; @Data @@ -22,7 +22,7 @@ public class UserSession { @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; // private String sessionId; - @OneToOne + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "user_id") private ChatUser user;