5 Replies Latest reply: Apr 29, 2013 5:23 AM by ramandeep singh - oracle RSS

    Transient master details view objects row creation

    SrinivasJilla
      Hi,

      I am trying to create rows in transient master details view objects.
      However, not able to see the created rows appropriately under respective parent.

      Components:
      DeptVO
      EmpVO
      DeptToEmpVL

      Am configuration:
      DeptVO1
      ----EmpVO2 (CHILD)
      EmpVO1

      AmImpl Method:
      public void createRows() {
      Row row,row2;
      for (int i = 0; i < 4; i++) {
      row = getDeptVO1().createRow();
      row.setAttribute("DeptId", "Dept" + i);
      row.setAttribute("DeptName", "Dept" + i);
      getDeptVO1().insertRow(row);
                }
      for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 5; j++) {
      row2 = getEmpVO1().createRow();
      row2.setAttribute("EmpId", i + "" + j);
      row2.setAttribute("DeptId", "Dept" + i);
      row2.setAttribute("EmpName", "emp" + i + j);
      getEmpVO1().insertRow(row2);
      }
      }
      }

      Executing the above method to populate parent and child records. When I see dept records, it doesn't show up associated emp rows.

      Can anyone help how can I achieve creation of rows for transient master detail records.

      Version using Jdev 11.1.1.6

      Thanks,
      Srini.
        • 1. Re: Transient master details view objects row creation
          ramandeep singh - oracle
          Hi,

          This is because you are not doing it correctly . You should not access the child view object instance separately. You should use access or relationship to create the rows.
          >
             DeptVOImpl deptVO=this.getDeptVO1();
                  DeptVORowImpl row=(DeptVORowImpl)deptVO.createRow();
                  deptVO.insertRow(row);
                  //gets child accessor rowset
                  RowIterator iterator= row.getEmpVO();
                  Number deptNumber=row.getDeptno().getSequenceNumber();
                  NameValuePairs nvps=new NameValuePairs();
                  nvps.setAttribute("Deptno", deptNumber);
                  EmpVORowImpl empRow=(EmpVORowImpl)iterator.createAndInitRow(nvps);
                  iterator.insertRow(empRow);
          --
          Ramandeep
          • 2. Re: Transient master details view objects row creation
            SrinivasJilla
            Thanks Ramandeep for quick reply.
            The reason to create them separately, both vos gets pouplated individually by reading values from 2 webservices.

            As I dont want to call the emp web service for each department I am trying above approach.
            In this way, all the emp rows gets pulled in one call which reduces multiple calls to the service.

            Please let me know if I am missing anything here.

            Thanks again.
            Srini.
            • 3. Re: Transient master details view objects row creation
              ramandeep singh - oracle
              Hi,

              So why don't you then populate all the master rows for the department and access it through an iterator and populate the child rows per department by copying from the other child view object.

              All i am saying is that the approach is incorrect as the master's child rowset is different then the one you are populating and hence it would not work and that is the way the product works.

              --
              Ramandeep
              • 4. Re: Transient master details view objects row creation
                SrinivasJilla
                Thanks again Ramandeep.
                I understand your point. I was thinking it should work as similar to that of query based vo.

                I am trying this approach because we are populating the 2 vos rows by following this approach
                "Using Programmatic View Objects for Alternative Data Sources" (http://sqltech.cl/doc/oas10gR31/web.1013/b25947/bcadvvo008.htm)

                With your clarification I don't see a way to work it out, as populating rows is taken care by the framework.
                Otherwise, I have to implement much of the copy rows logic which is a overhead.

                Please suggest if any possible solution/pattern/sample for rendering hirarchical data.

                Thanks,
                Srini.
                • 5. Re: Transient master details view objects row creation
                  ramandeep singh - oracle
                  Hi,

                  Does it work with a query based VO? The approach is flawed and that is what it is ? I have seen users face this issue in production systems that were using your approach.
                  With your clarification I don't see a way to work it out, as populating rows is taken care by the framework.
                  Hmm! it is taken care by framework alright if you follow the right approach.
                  "Using Programmatic View Objects for Alternative Data Sources" (http://sqltech.cl/doc/oas10gR31/web.1013/b25947/bcadvvo008.htm)
                  That approach does not talk about master detail hierarchy and only tells you how to populate rows for individual view objects.
                  --
                  Ramandeep