2 Replies Latest reply: May 3, 2012 4:03 AM by 895589 RSS

    ADF to Trinidad Migration :

    895589
      Hi All,

      I have migrated an ADF(10.1.3.2) Application into Trinidad using Jdeveloper(11.1.1.5) migrator.
      When i am trying to insert a record(Three values, one is Dynamic LOV, coming from DB table) in one table, It is inserting only one value(ROLE coming from dynamic LOV, ex ACCOUNT) every time. And if i tried to select some other value(from Dynamic LOV) it is giving me the below Exception,

      ----------------EXCEPTIONS------------------------------
      oracle.jbo.RowInconsistentException: JBO-25014: Another user has changed the row with primary key oracle.jbo.Key[1 ].
      at oracle.jbo.server.EntityImpl.checkChangeIndicator(EntityImpl.java:3253)
      at oracle.jbo.server.EntityImpl.setAttributeValueInternal(EntityImpl.java:3819)
      at oracle.jbo.server.EntityImpl.setAttributeValue(EntityImpl.java:3676)
      at oracle.jbo.server.AttributeDefImpl.set(AttributeDefImpl.java:3301)
      at oracle.jbo.server.EntityImpl.setAttributeInternal(EntityImpl.java:2012)
      at oracle.jbo.server.AttributeDefImpl.resolveSet(AttributeDefImpl.java:3510)
      **************************************************************************************************

      As per my understanding my Dynamic Lov is having some problem, bellow is the code,

      <tr:selectOneChoice value="#{bindings.AddUserRoleVO1RoleMastId.inputValue}"
                     binding="#{backing_jsp_security_manageUserRole.selectOneChoice1}"
                     id="selectOneChoice1"
                     unselectedLabel="Select One">
      <f:selectItems value="#{bindings.AddUserRoleVO1RoleMastId.items}"
                          binding="#{backing_jsp_security_manageUserRole.selectItems1}"
                          id="selectItems1"/>
      </tr:selectOneChoice>

      **************************************************************************************************
      Below is the java code--
      public String saveRole() {
           
      try{
      fctx = FacesContext.getCurrentInstance();
      roleMastVB = fctx.getApplication().createValueBinding("#{bindings.RoleMastVO1Iterator}");
      dciter = (DCIteratorBinding)roleMastVB.getValue(fctx);

      if(getSelectOneChoice1().getValue()==null){
      fctx.addMessage("", new FacesMessage(FacesMessage.SEVERITY_INFO,
      SafexAdminErrorMessages.INFO_SELECT_ROLE,
      SafexAdminErrorMessages.INFO_SELECT_ROLE));
      return null;
      }

      rowIndex = Integer.parseInt(this.getSelectOneChoice1().getValue().toString());

      roleMastRow = dciter.getRowAtRangeIndex(rowIndex);
      roleId = roleMastRow.getAttribute("Id").toString();

      application = fctx.getApplication();
      variableResolver = application.getVariableResolver();
      sessionStateMB = (SessionStateMB)variableResolver.resolveVariable(fctx, SafexMasterDataConstants.OPS_SESSIONMB);

      user = sessionStateMB.getUserName();

      createdBy = user;
      updatedBy = user;
      tempdt1 = new oracle.jbo.domain.Date();
      tempdt2 = new oracle.jbo.domain.Date();
      createdDate = tempdt1.getCurrentDate();
      updatedDate = tempdt2.getCurrentDate();

      adfFacesContext = RequestContext.getCurrentInstance();
      userId = adfFacesContext.getProcessScope().get("uId").toString();


      if(getSelectInputDate2().getValue()!=null){
      selectedExpiryDate = (java.util.Date)getSelectInputDate2().getValue();
      sdf1 = new SimpleDateFormat(SafexMasterDataConstants.OPS_DATE_FORMAT);
      expiryDateString = sdf1.format(selectedExpiryDate);
      expiryDate = java.sql.Date.valueOf(expiryDateString);

      roleAMDef = SafexAdminDataConstants.OPS_ROLE_AMDEF;
      roleConfig = SafexAdminDataConstants.OPS_ROLE_AMCONFIG;
      roleAM = Configuration.createRootApplicationModule(roleAMDef, roleConfig);
      userRoleVO = roleAM.findViewObject("AddUserRoleVO1");
      newUserRow = userRoleVO.createRow();
      System.out.println("saveRole()::::::::VO.createRow()::::::::::::::::::::::::::::");
      userRoleVO.insertRow(newUserRow);
      SequenceImpl userRoleSeq;
      userRoleSeq = new SequenceImpl("OPS_USER_ROLE_SEQ",roleAM);

      newUserRow.setAttribute("Id", userRoleSeq.getSequenceNumber());
      newUserRow.setAttribute("UserMastId", userId);

      newUserRow.setAttribute("RoleMastId", roleId);

      newUserRow.setAttribute("Status", status);

      newUserRow.setAttribute("EffDt", effectiveDate);

      newUserRow.setAttribute("ExpDt", expiryDate);

      newUserRow.setAttribute("CrBy", createdBy);

      newUserRow.setAttribute("CrDt", createdDate);

      newUserRow.setAttribute("UpdBy", updatedBy);

      newUserRow.setAttribute("UpdDt", updatedDate);



      roleAM.getTransaction().commit();

      dciter.releaseData();


      /**Function to referesh the Existing Roles Table */
      userid = adfFacesContext.getProcessScope().get("uId").toString();
      fctx = FacesContext.getCurrentInstance();
      userRoleVBind = fctx.getApplication().createValueBinding("#{bindings.UserRoleVO1Iterator}");
      userRoleIterator = (DCIteratorBinding)userRoleVBind.getValue(fctx);
      userRoleIterator.getViewObject().setWhereClause("QRSLT.USER_MAST_ID='" +
      userid + "'");
      userRoleIterator.executeQuery();

      /**Function to referesh the Role DropDown in Add Roles Form*/
      roleVBind = fctx.getApplication().createValueBinding("#{bindings.RoleMastVO1Iterator}");
      roleMastIterator = (DCIteratorBinding)roleVBind.getValue(fctx);
      roleMastIterator.getViewObject().setNamedWhereClauseParam("userid", userid);
      roleMastIterator.executeQuery();
      }

      finally{
      if(roleAM!=null){
      Configuration.releaseRootApplicationModule(roleAM, true);
      }
      }

      return null;
      }

      ***********************************************************************************
      There is no Trigger on the DB table.
      Code for EO--

      <Attribute
      Name="Id"
      IsUpdateable="while_insert"
      DefaultValue="0"
      ColumnName="ID"
      SQLType="NUMERIC"
      Type="oracle.jbo.domain.Number"
      ColumnType="NUMBER"
      TableName="OPS_USER_ROLE"
      PrimaryKey="true"
      RetrievedOnInsert="true"
      RetrievedOnUpdate="true">
      <DesignTime>
      <Attr Name="_DisplaySize" Value="22" />
      </DesignTime>
      </Attribute>

      *********************************

      Help Needed. Thanks,
      NJ