public void updateCommunityPositionInfo(CommunityPositionInfo poCmtPstInf) throws Exception {
   CommunityPositionInfoDAO voCommunityPositionInfoDAO = new CommunityPositionInfoDAO();
   try {
     context.getUserTransaction().begin();
     if (voCommunityPositionInfoDAO.validateCommunityPositionForUpdate(
             em, poCmtPstInf.getCommunityPositionID(), poCmtPstInf.getCommunityPositionDesc())
         == false) {
       voCommunityPositionInfoDAO.updateCommunityPositionInfo(em, poCmtPstInf);
     } else {
       String vaTmp =
           (String)
               em.createQuery(
                       "select (o.communityPositionID) from CommunityPositionInfo o where FUNC('REPLACE', UPPER(o.communityPositionDesc), ' ', '') = FUNC('REPLACE', UPPER('"
                           + poCmtPstInf.getCommunityPositionDesc()
                           + "'), ' ', '')")
                   .getSingleResult()
                   .toString();
       throw new ApplicationException(
           "มีรหัสตำแหน่ง <b>"
               + vaTmp
               + " - "
               + poCmtPstInf.getCommunityPositionDesc()
               + "</b> อยู่แล้ว");
     }
     context.getUserTransaction().commit();
   } catch (ApplicationException ae) {
     try {
       context.getUserTransaction().rollback();
     } catch (Exception ee) {
       System.out.println();
     }
     throw new ApplicationException(ae.getMessage());
   } catch (Exception e) {
     try {
       context.getUserTransaction().rollback();
     } catch (Exception ee) {
       System.out.println();
     }
     System.out.println("Exception : " + e.getMessage());
     throw new Exception(
         new StringBuffer("CommunityPositionlEJBServBean.updateCommunityPositionInfo : ")
             .append(e.getMessage())
             .toString());
   }
 }