* @param isSuperModerator
* @return
*/
public Long addRoomModeratorByUserId(Users us, Boolean isSuperModerator, Long roomId){
try {
RoomModerators rModerator = new RoomModerators();
rModerator.setUser(us);
rModerator.setIsSuperModerator(isSuperModerator);
rModerator.setStarttime(new Date());
rModerator.setDeleted("false");
rModerator.setRoomId(roomId);
Object idf = PersistenceSessionUtil.createSession();
EntityManager session = PersistenceSessionUtil.getSession();
EntityTransaction tx = session.getTransaction();
tx.begin();
rModerator = session.merge(rModerator);
long rModeratorId = rModerator.getRoomModeratorsId();
tx.commit();
PersistenceSessionUtil.closeSession(idf);
return rModeratorId;
} catch (Exception ex2) {
log.error("[addRoomModeratorByUserId] ",ex2);