7 Replies Latest reply: Jan 28, 2013 8:52 AM by san-717 RSS

    error when edit multiple records in a details table

    san-717
      Hi,

      I have a requirement to provide forms like details table which allows user to add new rows or edit rows in the same page and same table.

      My page is SetObjectivesPG under /oracle/apps/per/wpm/objectives/webui/

      I embeded my custom region in the standard page which allows user to add or edit in same table like forms.

      I can able to create mutlple records, and i'll save once I created all the records I want. But when I edit it is not allowing me to do multiple without committing each changes.

      I'm getting the following error:

      Unable to perform transaction on the record.
      Cause: The record contains stale data. The record has been modified by another user.
      Action: Cancel the transaction and re-query the record to get the new data.

      Please give suggestions to solve this issue.

      Thanks a lot in advance,
      SAN
        • 1. Re: error when edit multiple records in a details table
          Sushant Sharma
          Hi,

          The issue might be due to VO initialization.
          Can you please share your code that you are using to perform edit and commit operation ?

          --Sushant                                                                                                                                                                                                                                                                                                                   
          • 2. Re: error when edit multiple records in a details table
            san-717
            Sushanth,

            As per requirement I kept the fields are editable always..

            So I have one apply button which performs just commit option.

            my apply button code

            if("applyObj".equals(pageContext.getparameter(EVENT_PARAM))){
            oaam.getOADBTransaction().commit;
            }
            • 3. Re: error when edit multiple records in a details table
              Sushant Sharma
              Hi,

              It means there is only one button to save the newly created records as well as to save the already existing records.
              Can you please share your code that you are using to initialize the VO while create a new row ?

              --Sushant                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
              • 4. Re: error when edit multiple records in a details table
                san-717
                Sushanth,

                This is my apply and create code:


                if("AddGoal".equals(pageContext.getParameter(EVENT_PARAM))){
                Row newObjective=scorecardObjVO.createRow();
                scorecardObjVO.insertRow(newObjective);
                newObjective.setNewRowState(Row.STATUS_NEW);
                try{
                //scorecardObjVO.getCurrentRow().setAttribute("EditableFlag","Y");
                int scorecardId=Integer.parseInt(commonAM.findViewObject("ScorecardDetailsVO").getCurrentRow().getAttribute("ScorecardId").toString());
                scorecardObjVO.getCurrentRow().setAttribute("ScorecardId",scorecardId);
                scorecardObjVO.getCurrentRow().setAttribute("BusinessGroupId", pageContext.getBusinessGroupId());
                scorecardObjVO.getCurrentRow().setAttribute("OwningPersonId", sshrparams.getLoginPersonId());
                //scorecardObjVO.getCurrentRow().setAttribute("AlignedWithObjectiveId", Integer.parseInt(mgrObjVO.getCurrentRow().getAttribute("ObjectiveId").toString()));
                //scorecardObjVO.getCurrentRow().setAttribute("MgrObjectiveId", Integer.parseInt(mgrObjVO.getCurrentRow().getAttribute("ObjectiveId").toString()));
                scorecardObjVO.getCurrentRow().setAttribute("AppraiseFlag", "Y");
                scorecardObjVO.getCurrentRow().setAttribute("MeasurementStyleCode", "QUALIT_M");
                scorecardObjVO.getCurrentRow().setAttribute("PriorityCode", "1_L");
                scorecardObjVO.getCurrentRow().setAttribute("Attribute9", "MID-YEAR");

                PreparedStatement sysdateQuery=conn.prepareStatement("SELECT TO_DATE(SYSDATE) VALUE FROM DUAL");
                ResultSet rs=sysdateQuery.executeQuery();
                if(rs.next()){
                today=rs.getDate("VALUE");
                }
                scorecardObjVO.getCurrentRow().setAttribute("StartDate", today);
                }catch(Exception e){
                throw new OAException("Custom exception: "+e.toString(), OAException.ERROR);
                }
                }else
                if("ApplyGoal".equals(pageContext.getParameter(EVENT_PARAM))){
                oaam.getOADBTransaction().commit();
                }
                • 5. Re: error when edit multiple records in a details table
                  Sushant Sharma
                  Hi,

                  Is there any specific reason that you are using 'Row.STATUS_NEW' ?

                  Comment that line and instead of that, write below line after setting all the values (i.e. after 'scorecardObjVO.getCurrentRow().setAttribute("StartDate", today);'):
                  newObjective.setNewRowState(Row.STATUS_INITIALIZED);

                  Check this and let me know if you are still facing the issue.

                  --Sushant                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                  • 6. Re: error when edit multiple records in a details table
                    san-717
                    Sushanth,

                    I added that what you suggested..

                    Still I've same issue..

                    Actually what is happening now is :

                    If create multiple records , I can update any of these new records until I commit.

                    If I create new record, I cannot update any of the old data until I commit the new records.

                    Best case:
                    If i create records and commit its working. If i want to update these created records I need to go back to previous or home then its allowing me.

                    if update and try to save its working otherwise if i try to create new one it throws error lilke

                    Unable to perform transaction on the record. \nCause: The record has been deleted by another user. \nAction: Cancel the transaction and re-query the records * to get the new data.*
                    • 7. Re: error when edit multiple records in a details table
                      san-717
                      Hi,

                      I solved this issue by forwarding to current page once clicked the apply(save as draft) button.

                      Otherwise the state is remains invalid.

                      Thanks,
                      SAN