public MessageDetailsVO getMessageById(long id) throws Exception {
   SqlSession session = ConnectionFactory.getSession().openSession();
   MessageDetailsDAO dao = session.getMapper(MessageDetailsDAO.class);
   MessageDetailsVO messageDetailsVO = dao.getMessageById(id);
   session.close();
   return messageDetailsVO;
 }
 public List<MessageDetailsVO> getMessages() throws Exception {
   SqlSession session = ConnectionFactory.getSession().openSession();
   MessageDetailsDAO dao = session.getMapper(MessageDetailsDAO.class);
   List<MessageDetailsVO> users = dao.getAllMessages();
   session.close();
   return users;
 }
 public int deleteMessage(MessageDetailsVO vo) throws Exception {
   SqlSession session = ConnectionFactory.getSession().openSession();
   MessageDetailsDAO dao = session.getMapper(MessageDetailsDAO.class);
   int cnt = dao.doDeleteMessage(vo);
   session.commit();
   session.close();
   return cnt;
 }
 public MessageDetailsVO updateMessage(MessageDetailsVO vo) throws Exception {
   SqlSession session = ConnectionFactory.getSession().openSession();
   MessageDetailsDAO dao = session.getMapper(MessageDetailsDAO.class);
   dao.doUpdateMessage(vo);
   session.commit();
   session.close();
   return vo;
 }