2 Replies Latest reply on Jan 13, 2008 5:22 AM by Pete Muir

    Conversation ends on its own

    Vikram Chhetry Newbie

      Hi All,
      I am trying to edit User details in a very unorthodox manner, I dont know if this is cause for Conversation problem.

      My Code:-

      public class CallCenterAgentEditAction implements CallCenterAgentEdit {
      
       @Logger
       private Log log;
      
       @PersistenceContext
       private EntityManager entityManager;
      
       @Out(required = false)
       Person person;
       @Out(required = false)
       Account account;
       @Out(required = false)
       PersonContactDetail personContactDetail;
       @Out(required = false)
       Roles roles;
      
       @In
       FacesMessages facesMessages;
      
       public String prevSelectedCallCenterAgentDetails() {
       log.info("Inside editSelectedCallCenterAgentDetails method ");
      
       log.info("Exiting editSelectedCallCenterAgentDetails method");
       return "callCenterAgentEditPrev.xhtml";
       }
      
       @Begin
       public void getSelectedCallCenterAgentDetails(Account acc) {
       log.info("Inside getSelectedCallCenterAgentDetails method");
      
       int personId = acc.getPerson().getIpersonId();
      
       person = (Person) entityManager.createQuery(
       "from Person p " + "where " + "p.ipersonId = :personId ")
       .setParameter("personId", personId).getSingleResult();
      
       personContactDetail = (PersonContactDetail) entityManager.createQuery(
       "from PersonContactDetail p " + "where "
       + "p.person.ipersonId = :personId ").setParameter(
       "personId", personId).getSingleResult();
      
       int roleId = (Integer) entityManager.createQuery(
       "select pr.roles.iroleId from PersonRoles pr " + "where "
       + "pr.person.ipersonId = :personId ").setParameter(
       "personId", personId).getSingleResult();
      
       roles = new Roles();
       roles.setIroleId(roleId);
       account = acc;
       log.info("Exiting getSelectedCallCenterAgentDetails method");
       }
      
       @End
       public void updateCallCenterAgentDetails() {
       log.info("Inside updateCallCenterAgentDetails method");
       CallCenterAgent callCenterAgent = new CallCenterAgent();
       PersonRoles personRoles = new PersonRoles();
       Date date = new Date();
       log.info("After Creating object");
       person.setDtUpdated(date);
       account.setDtUpdated(date);
       personContactDetail.setDtUpdated(date);
      
       callCenterAgent.setIcallCenterAgentId(person.getIpersonId());
       callCenterAgent.setDtUpdated(date);
      
       personRoles.getPerson().setIpersonId(person.getIpersonId());
       personRoles.getPerson().setIpersonId(person.getIpersonId());
       personRoles.getRoles().setIroleId(roles.getIroleId());
      
       log.info("Updating the database");
       entityManager.merge(person);
       entityManager.merge(account);
       entityManager.merge(personContactDetail);
       entityManager.merge(personRoles);
       entityManager.merge(callCenterAgent);
       facesMessages.add("Successfully updated the Agent");
       log.info("Exiting updateCallCenterAgentDetails method");
       }
      
       @Remove
       public void destroy() {
       }
      
       public String editAgentMoveBack() {
       return "/callCenterAgentAdd.xhtml";
       }
      
       @End
       public void cancel() {
       }
      
      }
      


      <page view-id="/callCenterAgentManage.xhtml" login-required="true">
       <navigation from-action="#{callCenterAgentEdit.getSelectedCallCenterAgentDetails(details)}">
       <redirect view-id="/callCenterAgentEdit.xhtml" />
       </navigation>
      
       <navigation from-action="#{callCenterAgentManage.updateCallCenterAgentDetails}">
       <redirect view-id="/callCenterAgentManage.xhtml" />
       </navigation>
      
       <navigation from-action="#{callCenterAgentManage.cancel}">
       <redirect view-id="/callCenterAgentManage.xhtml" />
       </navigation>
      
       </page>
      



      edit xhtml
       <s:decorate id="fNameDecoration" template="layout/edit.xhtml">
       <ui:define name="label">First Name</ui:define>
       <h:inputText id="fName" required="true"
       value="#{person.strFirstName}">
       <a:support event="onblur" reRender="fNameDecoration" />
       </h:inputText>
       </s:decorate>
      


      when i try to change the details the conversation ends and after some time when I see the server logs it says multiple threads running and the screen hangs.

      Can anyone help me get througn this?
      Any help would be appreciated.

      -Vikram