diff --git a/src/main/java/com/example/cosmos_serversb/models/Groups.java b/src/main/java/com/example/cosmos_serversb/models/Groups.java index 9ee545d..db5d627 100644 --- a/src/main/java/com/example/cosmos_serversb/models/Groups.java +++ b/src/main/java/com/example/cosmos_serversb/models/Groups.java @@ -53,15 +53,12 @@ Group testGroup = new Group(gId, uri, name, uId); Session session = SessionManager.getInstance().getSession(); session.save(testGroup); - SessionManager.getInstance().closeSession(); - - session = SessionManager.getSession().getSession(); - testGroup.addMember(uId); - int n = testGroup.getMembers().size(); - - session.update(testGroup); - - SessionManager.getInstance().closeSession(); +// SessionManager.getInstance().closeSession(); +// session = SessionManager.getSession().getSession(); +// testGroup.addMember(uId); +// int n = testGroup.getMembers().size(); +// session.update(testGroup); +// SessionManager.getInstance().closeSession(); return testGroup; } @@ -141,6 +138,18 @@ */ } + //とりあえず作成。あとでaddMember()と統合させる。 + public static void addMemberWhenCreateGroup(Group group, String uId){ + Session session = SessionManager.getInstance().getSession(); +// Group editGroup = session.load(Group.class, "gId");//取得できない + Group editGroup = group; + if(editGroup != null) { + editGroup.addMember(uId); +// int n = testGroup.getMembers().size(); + session.update(editGroup); + } + } + public static HashMap getTestHashMap(){ return testMap; }