7 Replies Latest reply: Apr 1, 2013 5:04 AM by MohanVN RSS

    How to refresh one View instance from another View Instance

    MohanVN
      Hi ADF Experts,

      I have a requirement in which I have created two View Objects based on a single entity object.
      I am using a first VO to display data in a table and the second to update data to database.
      The commit will happen through a Global save button.
      But before the global save, I need to show the data using the First VO, which is inserted using the second VO.
      Can anyone help me on how to refresh the first VO to display the data.


      Thanks in Advance

      Mohan

      Edited by: 946185 on Mar 29, 2013 4:24 AM
        • 1. Re: How to refresh one View instance from another View Instance
          931325
          I have not tried this, but you can try to post your changes after you insert data on your second VO and refresh the first VO page by setting proper query mode
          //After VO2 insert
          //this.getDBTransaction().postChanges();
          //Set query mode for your VO1
          vo1.setQueryMode(ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES | ViewObject.QUERY_MODE_SCAN_ENTITY_ROWS | ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);

          But you might want not test how your screen saves the state during actv/passv.

          Good luck !
          • 2. Re: How to refresh one View instance from another View Instance
            Subramanian Meyyappan
            if i understoof correclty means it work.s you having a db table. you are having this as different vo in model layer . right
            just a partal trigger to that af:table(your first vo) itself enough.
            • 3. Re: How to refresh one View instance from another View Instance
              MohanVN
              Thanks for the response.

              I will definitely try and let you know the result.

              I got the same solution when I googgled the usecase.

              But when I discussed the same solution with my superiors, they say that this piece of code will raise some performance issues.

              Looks to me like there is no work around for this. Let me know if there is any another solution.


              Thanks
              Mohan
              • 4. Re: How to refresh one View instance from another View Instance
                MohanVN
                Hi User707,

                I hope that you didn't understand my requirement.

                The solution you have given would surely work out If I am having only one VO in the model layer.

                But I have two different VO's which are based on a single EO.
                One VO, say VO1 is used for displaying the data in the UI as a table.
                VO2 is used to update the table in the java code.

                So, when VO2 updates the data, VO1 should be getting the changes done by VO2.

                In this case having a partial trigger on the UI table using VO1 is not working out.

                Thanks
                Mohan
                • 5. Re: How to refresh one View instance from another View Instance
                  Dileep Rongali
                  Hi,

                  I don't understand why we need to create two VOs at first place. We can use the single VO for both display and update purpose. In that case we dont even bother about refreshing the VO after update.


                  Thanks,
                  Dileep.
                  • 6. Re: How to refresh one View instance from another View Instance
                    MohanVN
                    Hi Dileep,

                    The first VO which I mentioned is based on two EOs and has a lot of calculated values.
                    And to add to my worries there is a parent child relationship between the two EO's, where in parent is updated with one row and child with multiple rows.
                    The multiple rows updation to the child should happen with a shuttle component in a different popup.

                    So I am inserting everything programatically in the java code, where I need two use different VO to update parent and different VOs for the shuttle.

                    I could get the data, if it is committed, but to add to the complexity, there is a global save button which should commit the data.

                    So I want to get the data based on the EO update before commit to the database.

                    Thanks
                    Mohan
                    • 7. Re: How to refresh one View instance from another View Instance
                      MohanVN
                      Hi,

                      I Have tried the code below.

                      But with the line "vo1.setQueryMode(ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES | ViewObject.QUERY_MODE_SCAN_ENTITY_ROWS | ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);",

                      the query is returning many duplicate values.

                      I tried

                      this.getDBTransaction().postChanges();

                      ViewObjectImpl vo1=this.getEmployeeVO1();

                      vo1.executeEmptyRowSet();
                      vo1.executeQuery();

                      This is working fine.

                      Thanks
                      Mohan