2 Replies Latest reply: Jul 28, 2013 4:36 AM by 991850 RSS

    ADF Read only View insert row

    991850

      Dear colleagues, in JDeveloper

       

      I have simple table, Updatable view and ReadOnly view on the same table. I wish to make my ReadOnly view to have all updates in Updatable view without commit operation executed on Updatable view.

       

       

                       // First I createInsert on Updatable view AND FILL ALL FIELDS WITH VALUES

                      sBindingView =  "CustomersView1Iterator";

                      DCBindingContainer bc = (DCBindingContainer)getBindings();

                      if( bc != null )

                      {

                          // CREATEINSERT OPERATION BIND TO UPDATEBLE VIEW ITERATOR

                          OperationBinding createOperation = bc.getOperationBinding("CreateInsert");

                          if( createOperation != null )

                          {

                              createOperation.execute();

                              try

                              {

                                  DCIteratorBinding iter =

                                    (DCIteratorBinding)bc.findIteratorBinding(sBindingView);

                                  Row row1 = iter.getCurrentRow();

                                  for( int i = 0; i<12; i++) {

                                      row1.setAttribute(i, CopyVals[i]);

                                  }

                                  row1.setAttribute("Customernumber", nNewID);

                              }

                              catch (Exception e) {

                                  System.out.println(e);

                              }

       

                               // IF I COMMIT THEN MY READONLY VIEW WILL SEE ALL UPDATES

                              //OperationBinding commitOperation =

                              //    bc.getOperationBinding("Commit");

                              //commitOperation.execute();

       

                              // IF I SKIP COMMIT, MY READONLY VIEW WILL NOT SEE UPDATES MADE

                              Key key = new Key(new Object[] { nNewID });

       

                              // TRYING TO REFRESH READONLY VIEW - NO RESULTS

                              try

                              {

                                  //REFRESH READONLY VIEW ITERATOR

                                  sBindingView = "VCustomers1Iterator";

                                 

                                  // 1. Access the binding container

                                  //DCBindingContainer bc = (DCBindingContainer)getBindings();

                                  if( bc != null )

                                  {

                                      DCIteratorBinding iter =

                                        (DCIteratorBinding)bc.findIteratorBinding(sBindingView);

                                                                     

                                      iter.executeQuery();   

                                      iter.refresh(DCIteratorBinding.RANGESIZE_UNLIMITED);

                                  }

                              }

                              catch (Exception e) {

                                  System.out.println(e);

                              }

                             

                          }

                      }

        • 1. Re: ADF Read only View insert row
          Frank Nimphius-Oracle

          Hi,

           

          this is because your read-only view object reads from the database and not through the entity cache. Note that in fact having a view object read only and an updateable view object querying the same table is in fact more expensive than querying two updateable view objects as bot would use a shared entity cache. Not knowing what your motivation for a read-only view object is, its not of better performance.

           

          Frank

          • 2. Re: ADF Read only View insert row
            991850

            Dear Frank, million thanks for the answer!

             

             

             

            Could I ask you please, wherther it is a good practice for database applications to have a main screen with read only, single row selected adf table based on some table entity in database (read only adf view object or iterator based on some select statement) and then a detailed form for insert/update/delete records from/to this table based on updatable view object on the same entity table in databse?

             

             

            Or you mean in any case should try first to use in both jspx (table list of records and form record ) the same datacontrol, based on updatable view object and to forget a problem to synchronize them every time the user select an action(insert/update/delete)? Then my question what if I need to have parameters in my read only (select - based) query and wish a user to setup these parameters on the main screen, select records with Execute with parameters and then edit records on the second screen with updatabale view object, which currently I manually synchronize with the first readonly dataobject from the main screen?

             

             

            Will very appreciate your answer!