4 Replies Latest reply: Sep 18, 2013 12:48 AM by user13424229 RSS

    Need help in inserting data into table in oaf

    user13424229

      Hi ALL,

       

      I have a insert page having 4 text fields and 4 LOVs, for one of the text field i am defaulting a sequence value while page loading and when i am inserting data to a table after entering all the fields it is basically inserting three records to the table instead of 1, so first two rows having null in all the fields in the table except first field which is a sequence, and last row having my actual data what i entered, could some one help where might be the problem.

       

      I am setting the sequence value for the field in EO as below:

       

      public void create(AttributeList attributeList) {
              super.create(attributeList);     
             
              OADBTransaction transaction = getOADBTransaction();

              Number contID = transaction.getSequenceValue("XX_SEQ");

               setContainerizationId(contID);
                 
           System.out.println("containzation id is"+contID);
          }

       

      I am using EO based VO, Please help me its urgent.

       

       

       

       

      Thanks.

        • 1. Re: Need help in inserting data into table in oaf
          Mahesh112

          Hi,

           

          Please share how you are using this EO based VO and please share your Code.

           

          Regards

          Mahesh

          • 2. Re: Need help in inserting data into table in oaf
            user13424229

            Hi Mahesh,

             

            Thnaks for the reply, in my process request i called the am method like below:

             

            OAApplicationModule am = (OAApplicationModule) pageContext.getApplicationModule(webBean);

                  am.invokeMethod("InsertRecord");

             

            in AM:

             

            public void InsertRecord()
                   {
                    XXDPECONTAINERVOImpl  vo=getXXDPECONTAINERVO1();
                   
                     if(!vo.isPreparedForExecution())
                     {
                       vo.executeQuery();
                     }
                   
                   Row row=vo.createRow();

                   vo.insertRow(row);

                   row.setNewRowState(Row.STATUS_INITIALIZED);

                   }

             

            public void saverecord()

                   {

                     getTransaction().commit();

                   

                   }

             

            in PFR:

            am.invokeMethod("saverecord",null); --- for the button event.

             

             

            Issue is i am able to insert data but it is inserting 3 times to the table, first two lines with blank data only first field populating and last row contains all the data.

             

            Thnaks

            • 3. Re: Need help in inserting data into table in oaf
              user13424229

              Mahesh , while debugging i checked that the insert method is called 3 times in the PR ,so the problem i got is when i am clicking the LOV in the page , the page is loading again and the insert method is invoking again and again so thats why it is inserting multiple times, so i tried with changing the LOVINPUT field to text input field , it is inserting properly with one time,

               

              So could any one please suggest me how i can handle the LOV item field to restrict the page refresh again and again,

               

               

              Thanks

              • 4. Re: Need help in inserting data into table in oaf
                user13424229

                Can any one help me on this, its urgent