diff --git a/src/main/java/com/example/cosmos_serversb/entities/Group.java b/src/main/java/com/example/cosmos_serversb/entities/Group.java index 4c98291..7b2805b 100644 --- a/src/main/java/com/example/cosmos_serversb/entities/Group.java +++ b/src/main/java/com/example/cosmos_serversb/entities/Group.java @@ -1,7 +1,9 @@ //このクラスは仮です package com.example.cosmos_serversb.entities; +import com.example.cosmos_serversb.models.SessionManager; import com.example.cosmos_serversb.models.Users; +import org.hibernate.Session; import java.util.ArrayList; import java.util.HashSet; @@ -87,8 +89,14 @@ public void addMember(String uId){ // User user = new User(uId, uId, "http:test", "hogehoge"); User user = Users.getInstance().getUserById(uId); - members.add(user); -// user.addGroups(this); + if(user != null) { + members.add(user); + user.addGroups(this); + Session session = SessionManager.getInstance().getSession(); + session.update(user); + }else{ + //例外処理 + } } }