This discussion is archived
5 Replies Latest reply: Jan 31, 2013 8:29 AM by Fedor RSS

How to handle make current for programmatic VO

872999 Newbie
Currently Being Moderated
I have a view object that populates row-sets based on a procedure. The procedure returns an oracle object list, which I am able to convert to the View Object's row.
The executeQueryForCollection() runs my procedure stores my data using
    protected void executeQueryForCollection(Object qc, Object[] params,
                                             int noUserParams) {
        Object[] bind_variable = null;
        String qry =
            "begin hr.PROC_test(:1); end;";
        try {

                CallableStatement stmt =
                    getDBTransaction().createCallableStatement(qry,
                                                               getDBTransaction().DEFAULT);
                
                stmt.registerOutParameter(1, OracleTypes.ARRAY,
                                          "hr.TEST_REC_TABLE");
                stmt.execute();
                Array arr = stmt.getArray(1);
                Object[] array = (Object[])arr.getArray();
                ROW_COUNT = array.length;//my way to get estimated row count, since the row count for my result set is unpredictable. max of 3000 records

                rs = arr.getResultSet();

                storeNewResultSet(qc, rs);

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            super.executeQueryForCollection(qc, params, noUserParams);//I don't know whether this is really required
        }
    }
    private void storeNewResultSet(Object qc, ResultSet rs) {
        ResultSet existingRs = getResultSet(qc);
        // If this query collection is getting reused, close out any previous rowset - got from below link
        if (existingRs != null) {
            try {
                existingRs.close();
            } catch (SQLException s) {
                s.printStackTrace();
            }
        }
        setUserDataForCollection(qc, rs);
        hasNextForCollection(qc); // Prime the pump with the first row.
    }
The View object is used in a page as a readonly table.
Now the problem I am facing is :
When I select a row, the make current property of table gets fired. This will call executeQueryForCollection with an additional param (bind variable) with name "fbkKy__0" (i believe it is find by key) and value : my current row's key value.
Since my executeQueryForCollection is called, the procedure gets executed again(This is also not required because, the procudure does takes time, and is not required to re-execute always).
The UI table will show the selection, but my iterator is pointing to the first row. And as a result am not able to get the current row in the bean.

I developed the above VO based on below link and the fusion middle ware developer's guide.
ref : http://adfpractice-fedor.blogspot.in/2011/01/adf-bc-programmatically-populated-vo.html

ADF 11.1.1.3.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points