4 Replies Latest reply: Feb 13, 2014 9:15 AM by 1000723 RSS

    ADF - Not able see any new inserted /uptated records

    sevanan

      Hi Guys

       

      Please anyone help me,

      1. Very first time I have inserted  one  record into DB through ADF  and it works fine

      2. I tried to insert another record through my ADF application and it was there  DB .

       

      Issue - I can see only the first record in my ADF application and I am not able to see the second record where as both records were present in the DB.

       

      -Sevanan

        • 1. Re: ADF - Not able see any new inserted /uptated records
          Cvele_new_account

          Hi,

           

          How you are displayed DB records in the UI ?

          Tried to set iterator ChangeEventPolicy to be ppr ?

          • 2. Re: ADF - Not able see any new inserted /uptated records
            Timo Hahn

            User, which jdev version do you use?

             

            How are you displaying the data from the DB on the page?

            Do you use an af:table?

            Or an af:form?

            Do you commit the action (after adding the new record)?

             

            Timo

            • 3. Re: ADF - Not able see any new inserted /uptated records
              sevanan

              Hi Timo

              My jdev version is 11.1.1.6.0,

               

              The issues are

              scenario1

              =======

              1 very first time I have inserted  one  record into DB through ADF  and it works fine (I can see this record in DATABASE,  MODIFY and DELETE pages )

              2. I have inserted another record but this record not visible in my MODIFY and DELETE pages but record was there in DB.

              scenario2

              =======

              1 very first time I have inserted  one  record into DB through ADF  and it works fine (I can see this record in DATABASE,  MODIFY and DELETE pages )

              2. I have modified one record in my MODIFY page but it was not rectection in UI but in DB it was updated

               

              My code snippet as follows, I am displaying values in jspx fa:form , May be I missed something in databinding hence I am new to the adf

               

                      conn = getConnectionDS(DS_NAME);M
                      conn.setAutoCommit(true);
                      Statement stmt = conn.createStatement();

               

                      String insertQuery =
                          "insert into IS_UI_USER_ROLES values(" + roleId + ",'" + name +
                          "','" + desc + "')";
                      System.out.println(" INSERT Query  " + insertQuery);

               

                      status = stmt.executeUpdate(insertQuery);

               

                     

              conn.close();

               

               

              ================

              <af:showDetailItem text="Add Role" id="sdi1">

                                  <af:panelFormLayout id="pfl3">

                                    <af:inputText label="Role Name" id="it24"

                                                  validator="#{RoleDetails.role_validator}"/>

                                    <af:inputText label="Role Desc" id="it25"

                                                  validator="#{RoleDetails.desc_validator}"/>

                                    <af:inputText label="Role ID" id="it26"

                                                  validator="#{RoleDetails.roleid_validator}"/>

                                    <af:commandButton text="Add" id="cb26"

                                                      action="#{RoleDetails.insert_action}">

                                      <af:resetActionListener/>

                                    </af:commandButton>

                                  </af:panelFormLayout>

               

               

              • 4. Re: ADF - Not able see any new inserted /uptated records
                1000723

                Hi,

                 

                Why are you "communicating with the db" using the connection object ?

                I guess you should use view object (and more precisely the VO on which your panel form is based).

                for ex:

                DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();

                DCIteratorBinding dcItteratorBindings = bindings.findIteratorBinding("YOUR_VO_NAME_AS_IT_FIGURS_IN_THE_BINDING");

                  ViewObject VO = dcItteratorBindings.getViewObject();

                  NameValuePairs nvp = new NameValuePairs();

                  nvp.setAttribute("attrName", attValue);

                  Row row = VO.createAndInitRow(nvp);

                  VO.insertRow(row);

                //don't forget to commit

                 

                If you still want to use the method you posted, try reloading the VO after commiting:

                VO.executeQuery();

                 

                Elias.