ADF/BC4J fetches all rows, should fetch only if needed

Hello,
I'm using JDeveloper 10.1.2. Technologies are Struts, ADF and BC4J.
I have a problem with viewObjects. I have created components from database tables. I'm fetching in appModuleImpl:
ViewObjImpl impl = getObjectViewImpl();
impl.setWhereClause("id=101");
impl.executeQuery();Problem is that when page is loaded, it fetches ALL ROWS (80 000 rows)from table and then makes another query to fetch group above. I want only fetch rows that i decide to fetch. My application is in immediate mode. Couple of iterators has fetch range -1 and couple 10.
I have debugged that the first ALL ROWS fetch is made somewhere out of my code.
What i'm doing wrong? Any feature development hints are welcome also.
Thank you advance!
null

hello
First of all thank you for commenting on my timeout post
I think i have a solution for you problem.
If i understand you correctly, when the page is loaded, you only want the framework to only fetch one page worth of rows, look yahoo and google. Then when you select another page, you want the other records to be fetch.
public void executeQuery() {
setAccessMode(RowSet.RANGE_PAGING); //shall do the trick
super.executeQuery();
Djbo.debugoutput=console
SELECT * FROM (SELECT /*+ FIRST_ROWS */ IQ.*, ROWNUM AS Z_R_N FROM (select * from emp) IQ WHERE ROWNUM < :0) WHERE Z_R_N > :1
[253] Bind params for ViewObject: ViewObj1
[254] setting rownum query between (0, 4)
As shown above, the query is designed to only fetch 4 rows and this is managed by manipulating the ROWNUM.
When you run it the page will only display RANGE_PAGE only execpt of the 80,000 and your first page will run very fast
This will cause a database hit each time you select another page! If you ask the framework designer, i bet, they shall tell you we are avoiding database hits with this. My answer to them, who would go about navigation all pages anyway!
Kindly comment if the code above solved your issue or not
Ammar Sajdi
Amman - Jordan

Similar Messages

  • OracleXMLQuery not fetching ALL rows

    Problem:
    ======
    For example, if there are 10 rows in the Table, sometimes the XMLQuery sees less than 10 rows. We wrote a small test program with a JDBC query for select count(*) from Table, which always shows 10. So nothing wrong with Connection/Statement settings. They all use DEFAULT settings (READ_COMMITTED, TYPE_FORWARS_ONLY).
    Why does n't XMLQuery see all rows available from the Query?
    Software Version:
    ============
    Oracle 10.1.0.5
    XDK: Oracle XDK 10g
    JAVA 5
    My program:
    =========
    Connection connection = dataSource.getConnection();
    Statement stmt = connection.createStatement(); <-- We tried with TYPE_SCROLL*. Still not working.
    ResultSet rs = stmt.executeQuery("select * from MyTable);
    //1. Query the database with the OracleXMLQuery. Result will be in XML format.
    OracleXMLQuery query = new OracleXMLQuery(connection, rs);
    query.keepObjectOpen(true);
    query.setMaxRows(1); //We don't want to build huge XML DOM for all rows.
    while (rs.next()) { <--- Ideally it should iterate 10 times XMLDocument xmlDoc = (XMLDocument) query.getXMLDOM();          
    System.out.println(xmlDoc);
    if (query.getNumRowsProcessed() > 0) {          
    //Do something here
    Thanks.
    Kanugula.

    I am providing the stack trace. You have more information.
    By the way, what surprises me is "OracleXMLQuery sees 1/2 of the rows only. Means if you have 12 rows, it sees 6 only"
    query= OracleXMLQuery (id=2148)
    conv= OracleXMLConvert (id=2154)
    colCount= 48
    collectTimingInfo= false
    collIdAttrName= null
    collItemTag= "_ITEM"
    colNames= OracleColumnName[48] (id=2376)
    colNamesHash= Hashtable<K,V> (id=2377)
    conn= LogicalConnection (id=2145)
    curCount= 2
    dataHeader= null
    dateFormat= "yyyyMMddhhmmss"
    docTag= null
    docType= 1
    dset= OracleXMLDataSetExtJdbc (id=2378)
    bindPosHash= null
    conn= LogicalConnection (id=2145)
    connUser= null
    cursorCols= int[0] (id=2380)
    dsetList= null
    isConsistent= true
    msg= XSUMesg (id=2166)
    ncharSuported= true
    rmdata= OracleResultSetMetaData (id=2381)
    rowCount= 4
    rset= ScrollableResultSet (id=2147)
    close_statement_on_close= false
    m_allRowsCached= false
    m_autoRefetch= true
    m_beginColumnIndex= 0
    m_cache= OracleResultSetCacheImpl (id=2190)
    m_columnCount= 48
    m_conn= T4CConnection (id=2195)
    m_currentRow= 6
    m_lastRefetchSz= 0
    m_metadata= OracleResultSetMetaData (id=2371)
    m_numRowsCached= 6
    m_refetchRowids= null
    m_refetchStmt= null
    m_rset= OracleResultSetImpl (id=2196)
    m_scrollStmt= T4CStatement (id=2146)
    m_type= 1004
    m_update= 1007
    m_usrFetchDirection= 1000
    m_warning= null
    m_wasNull= 0
    rsetFirstTime= false
    rsetIsExt= true
    rsetVal= true
    sdf= SimpleDateFormat (id=2382)
    stmt= null
    tempS= T4CStatement (id=2146)
    dsetIsExt= false
    DTDString= null
    errTag= "ERROR"
    extException= null
    firstXElemNmIdx= 0
    isNull= "TRUE"
    keepCursor= true
    maxRows= 1
    metaHeader= null
    metaType= 0
    miscFlags= 0
    namesValid= true
    noRowsException= false
    notNull= "FALSE"
    nullAttrId= "NULL"
    objClosed= false
    qstring= null
    raiseException= false
    refAttrName= "REFTYPE"
    rootNodeSupplied= false
    rowCountStr= "num"
    rowIdAttrDt= 2
    rowIdColName= null
    rowIdColNum= 0
    rowsetTag= "ROWSET"
    rowTag= "ROW"
    rset= ScrollableResultSet (id=2147)
    rsetIsExt= true
    skipRows= 0
    styleSheetType= null
    styleSheetURI= null
    tagCase= 0
    tim= null
    tns= null
    updateDateFormat= false
    useColumnLabelAsRoot= false
    useNullAttrId= false
    useTypeForCollElemTag= false
    val= OracleScalarName (id=2379)
    xAttrAfterElem= false
    xAttrIdxs= null
    xElemCnt= 48
    encoding= null
    encSet= false
    xslp= null
    xslt= null

  • Fetch all Subsite for Read-only user

    HI,
    I have a site collection in which the users have only "Read" access.
    I would like to fetch all the sites(incuding root site, subsites), which the user has access. How to achieve this in Javascript client object model?
    I have tried using get_web().get_webs(), but since the user has only "Read" access, I am getting access denied error when trying to load the site.
    How to fetch all the sites(incuding root site, subsites), in the sitecollection using Javascript client object model?
    Thanks

    Hi,
    Refer to following post: 
    http://social.msdn.microsoft.com/Forums/en-US/fb318464-916c-4d0a-ae59-8511b58b6309/run-code-with-elevated-privileges-in-client-object-model
    It summarizes as below:
    The SharePoint 2010 client object model does not support SPSecurity.RunWithElevatedPrivileges.
    Since you're code runs on the client, the identity can not be reverted to the application pool account. Running code as system account via the client object model would open a security hole and then everybody could write and execute code as an administrator.
    Another possible way is to develop a custom web service on the server which run the code in RunWithElevatedPrivilege() method and then call the web service from the client object model.
    you may refer to the this blog post giving a simple example of creating WCF service for SharePoint 2010:
    How
    to Create WCF Web Service on SharePoint 2010
    You would also like to have a brief look at the screencast for Building and deploying a WCF service to SharePoint 2010:
    http://www.codefornuts.com/2010/04/building-and-deploying-wcf-service-to.html
    Hope it helps!
    Avni Bhatt

  • Strange Problem: Cursor not fetching all rows

    Hello,
    When fetching from a cursor on a PL/SQL block in a stored procedure, the cursor seems to stop in the middle of the loop without an exception. The number of rows the cursor fetches varies from call to call. The same problem repeats in a FOR loop, direct CURSOR open and calling the fetch directly in the FOR loop.
    The strangest thing is that I took the code and executed it on an external script and it worked fine.
    What can cause the cursor to stop?
    Thanks

    Hi,
    Could you paste your stored procedure?
    cheers

  • Accessing all rows in Entity Object

    Hi All,
    I have a master-child relationship with ChildVO based on entity object. When user hits on save after making some changes, I would like to pass all rows in master view object and all fetched rows in entity object to a pl/sql api which takes pl/sql table datatypes. I would call this API in AM. So is there any way to access all entity rows of child view object?I tried to use view link accessors but it returns null. I can think of the following way:
    for each row in master view object
    loop
    set current row for master view object. This would execute child vo for that master row.
    then fetch all rows from child vo. populate pl/sql table
    move on to next master vo row.
    end loop;
    Drawback with above approach is that we would excute child object query for every master row. Is there any direct way to access rows in entity object in AM? Any pointers on this would be of great help.
    Thanks in advance,
    Murari

    "and all fetched rows in entity object"
    is not a correct statement to make, EO will always represent a single row of the database record.you will get all the fetched rows in the VO, not the EO.
    Tapash

  • How to set selected all rows in h:dataTable

    hello, I want to selected all rows in a dataTable.
    I use JS to got it:
    the selectBooleanCheckbox in the header of row:
    <t:selectBooleanCheckbox id="aa" value="#{list.checkbox}" />the JS code :
    <script type="text/javascript" language="JavaScript1.2">
        function selectAll(obj, first, size) {
            for (var i = 0; i < size; i++) {
                var current = eval(first - 1 + i);
                var objs = document.getElementById("form:listbody:listtable:" + current + ":aa");
                obj.checked ? objs.checked = true : objs.checked = false;
    </script>and the "selectall" code:
    <h:selectBooleanCheckbox id="selectAll"
                                  onclick="javascript:selectAll(this,#{firstRow},#{displayedRowsCount})"/>It run good in IE,but not it does not work in firefox.
    Are there some method to do?
    Or is there a method to select all rows just use JSF?
    Needs you help!

    Yes, the paging for <h:dataTable> works pretty good, it manages the task through four methods created in the java code -- DataTable1_firstPageAction(), DataTable1_previousPageAction(), DataTable1_nextPageAction(), DataTable1_lastPageAction() -- without adding any javascript in the jsp page.
    Maybe I could test if a java script similar to the <ui:table>'s one fit also the dataTable...
    thanks

  • Rowtype not fetching all the rows

    This my cursor declaration. When the Package is executed it get all records minus 1 (Assumming there are 10 rows to be processed, it ONLY processes 9 records)
    cursor X1 is
    select *
    from NT
    hdr X1%rowtype;
    Below is the procedure call
         open X1;
         fetch X1 into hdr;
         loop
         exit when X1%notfound;
                   fetch X1 into hdr;
                   pkgXX.insrt(hdr);
         end loop;
              commit;
         close X1;

    That makes sense. You 1) fetch a row, 2) check for %notfound, 3) fetch a row and process it. Notice that the row you fetched in 1 was never processed. Try this:
    open X1;
    loop
      fetch X1 into hdr;
      exit when X1%notfound;
      pkgXX.insrt(hdr);
    end loop;
    commit;
    close X1;

  • Query should fetch all the query details in the system.

    Hi All
    We  are looking for a query which will fetch all the query details in the system along with the user names either who has created the query or who has run it atleast once.
    If any of the queries are not used for a long time then we  can delete it with the user's/owner's approval.
    Is there anyway we can desing such query .
    Thanks
    Asim

    Hi,
    Thanks for the reply.
    My requirement is that we want to create a new query which should fetch the details information of already existing queries.
    Like who has created that query, how frequently the use it etc...
    Whenever we run the new query it should give information of all other existing queries.
    Thanks and Regards
    Asim

  • Stop ADF from fetching all data on startup

    Hi all,
    I have built an ADF page with a search form on it. Goal here obviously is to search the DB for certain user entered criteria. The problem now is that ADF fetches all data before the user has enetered anything. Pretty annoying, as it takes about 5 minutes to fetch the 1 mil records over VPN. And not very performant either...
    How can I stop ADF from doing this?
    Thanks,
    Stijn.

    Hi,
    2 topics here that I'll address one after the other
    1. ADF fetches nothing. The business Service layer does. If you use ADF BC for example then you can define the number of records that are fetched initially. If you use EJB then this kind of intelligence is all yours to implement. Same then for POJO and Web Service. If you are working with a million of records, think about using query hints in your query to boost performance.
    2. To solve your issue
    - assuming you use ADF BC: Set the iterator to find mode or set the query condition to where it finds no hits. If your query uses bind variables then it is enough to not provide a default value for the bind variable. Another option is to use a invokeAction method and set the iterator into findMode upon page load
    - If you use EJB, make sure the initial query also doesn't return any hits
    Note that for the refresh property on teh iterator there are other conditions like "deferred" that you may want to try out
    Frank

  • ADF: Best way to find out how many rows are fetched?

    Hello,
    I have overridden method executeQueryForCollection of ViewObject in which I execute supper.executeQueryForCollection and after that want to find out how many rows are fetched during the execution.
    If I try to use getFetchedRowCount I always get "0", if using getEstimatedRowCount, query are being re-executed.
    What method is better to use for that?
    Thank you,
    Veniamin Goldin
    Forbis, Ltd.

    I have a 'home-made' view called RBS, whose definition is this:
    create view RBS as
    select /*+ RULE  */ substr(s.username,1,10) oracle,
           substr(case when s.osuser like 'oramt%'
                       then nvl(upper(s.client_info),'client_info not set')
                       else substr(s.machine,instr(s.machine, '\')+1,length(s.machine))||':'||s.osuser
                  end
                  ,1,20) CLIENT
    ,      substr(''''||s.sid||','||s.serial#||''''||decode(s.status,'KILLED','*',''),1,12) kill_id
    ,      lpad(to_char(t.xidusn),4) rbs#
    ,      lpad(to_char(t.used_ublk),4) ublk
    ,      lpad(to_char(t.used_urec),8) urecords
    ,      i.block_gets
    ,      lpad(to_number(round((sysdate - to_date(t.start_time,'MM/DD/YY HH24:MI:SS')) * 60 * 60 * 24)),9) time
    ,      upper(substr(s.program,1,20)) PROGRAM
    ,      to_char(s.LOGON_TIME,'HH24:MI:SS DD-MON') LOGIN_TIME
    from   sys.v_$transaction t
    ,      sys.v_$session s
    ,      sys.v_$sess_io i
    ,      sys.v_$process p
    where  s.saddr = t.ses_addr
    and    i.sid = s.sid
    and    p.addr = s.paddr
    /By monitoring the URECORDS column value of the row that corresponds to my session doing a transaction, I can see how it progresses.
    Toon

  • Resultset - retrieves all rows or only one at a time

    Hey guys,
    I am using oracle DB. Lets say the query i run has about 1000 records
    when i call:
    prepareStmt(cstmt);
    Rsultset rs = cstmt.executeQuery();
    Do I get all the records, or do i get them one by one
    when i call
    rs.next
    is this DB specific??
    This is simple q, but i been working with oracle and java for a while, and for some reason this never came up.
    thank you.

    The driver implementation is free to retrieve as many or as few rows at a time from the database as it wants. You can suggest to the driver how many rows at a time it should retrieve with setFetchSize(); the driver is free to ignore your suggestion (but many drivers honor it). The fetch size default varies wildly from driver to driver, from 1 row at a time to all rows at a once. For the Oracle thin driver, the default is 10, which is usually too small to give the best performance (I use between 100 and 1,000, usually 250).
    Note that when you're working with a very large ResultSet, a driver that does "all rows at once" can cause you to run out of memory. Also, some drivers will cache every single row when using a scrollable ResultSet (and again run you out of memory) but not do so with a forward-only ResultSet (Oracle has this issue).

  • Fetching all text components for query - RSRREPDIR / RSZELTXREF / RSZELTTXT

    Hi all,
    I am developing a tool to fetch all the text components for a BI query. The texts are then to be translated and uploaded back to the BI system, but right now we are first focusing on downloading the texts.
    In the tool, the user inputs the query technical name on the screen, after which my approach is as follows:
    1) Fetch Query UID from table RSRREPDIR using Query technical name.
    2) Fetch all element UIDs from table RSZELTXREF using Query UID and by resolving the hierarchies. Agreed, the hierarchies in the table RSZELTXREF are very complex.
    3) Provide all element UIDs, including root query UID, to the table RSZELTTXT, and fetch TXTSH and TXTLG texts.
    Now, my question is at step 2: Which are the UIDs that I should fetch? Specifically, should I fetch only those UIDs which have Layout Type as 'ROW' / 'COL' / 'SHT', or should I fetch all UIDs regardless of Layout Type?
    Secondly, my understanding is that because of the table hierarchy, I should continuously feed the field TELTUID back to SELTUID until the Layout Type is 'NIL'. When this happens, I am at the Element Level. Is this correct?
    Thanks in advance,
    Shailesh.

    Now in the following code, why are u creating a new form?
    Why dont you use the form which is input to the Action Class's execute methof?
    if(rs.next()){
    EditForm e=new EditForm();
    e.setEmpname(rs.getString(1));
    }Thanks and regards,
    Pazhanikanthan. P

  • Fetching all data from MS access PROBLEM !!!

    Hi all,
    I am having problem of fetching all data from MS ACCESS, ie, I have 112 rows of data, yet when executing query SELECT * ... only 70 items are retrieved. Don't know why, but the retrieval prcess stops on item 69 and want get the rest of the data.
    I am executing the query in a WHILE loop, don't specify the number of loops !!! so I should be able to get all of the data. Why then I always only get 69?
    Second q.
    What is the right SYNTAX for retrieving specific data. ie. SELECT id from images WHERE size = 58
    is this correct? ie. size is declared as number?
    ANy help would be much appreciated.
    Thanks

    1. Where from you are fetching the data? Is it from bean or JSP or servlet? Can you post the code?
    2. Yes. the sql syntax is correct.

  • Abap logic not fetching multiple rows from master data table

    Hi
    I just noticed that my logic is fetching only 1 row from master data table.
    ProdHier table
    PRODHIERACHY            Level
    1000                                  1
    1000011000                      2
    10000110003333              3
    10000110004444              3
    '10000110005555              3*
    logic only fetches one row of level 3, I would like to fetch all level 3 rows.
    DATA: ITAB type table of /BI0/PPROD_HIER,
          wa like line of ITAB.
    Select * from /BI0/PPROD_HIER INTO wa where /BIC/ZPRODHTAS = 3.
    IF wa-PROD_HIER(10) = SOURCE_FIELDS-PRODH2.
         RESULT = wa-PROD_HIER.
         ELSEIF wa-PROD_HIER(5) = SOURCE_FIELDS-PRODH1.
         RESULT = wa-PROD_HIER.
    ENDIF.
    ENDSELECT.
    thanks

    Hi,,
    I have implemented the logic in end routine and it still reads only the first row.
    I am loading only PRODH1 and PROD2 but now I want to get all values of PRODH3 from the master data table.
    The first 5 values are PRODH1 and first 10 values belongs to PRODH2.
    Whenever PRODH2 = 1000011000 in source I should get the following values
    10000110001110
    10000110001120
    10000110001130
    I have multiple rows of 1000011000 so my result should be
      1000011000               10000110001110
      1000011000               10000110001120
      1000011000               10000110001130
    DATA: ITAB type table of /BI0/PPROD_HIER,
    wa like line of ITAB.
    data rp type _ty_s_TG_1.
    Select  * from /BI0/PPROD_HIER INTO table itab where /BIC/ZPRODHTAS = 3.
    LOOP AT RESULT_PACKAGE INTO rp.
    read table itab into wa with key PROD_HIER(5) = rp-PRODH1.
    IF sy-subrc EQ 0.
         rp-PRODH3 = wa-PROD_HIER.
         ELSE.
    read table itab into wa with key PROD_HIER(10) = rp-PRODH2.
    IF sy-subrc EQ 0.
         rp-PRODH3 = wa-PROD_HIER.
    ENDIF.
    ENDIF.
    MODIFY RESULT_PACKAGE FROM rp.
    ENDLOOP.
    Edited by: Bhat Vaidya on Sep 10, 2010 11:27 AM
    Edited by: Bhat Vaidya on Sep 10, 2010 11:37 AM

  • Cycle Counting is not fetching All Items in Different Classes

    Hi All,
    My client has performed cycle counting. Ideally system has to fetech all the items in different classes. But in cycle counting listing report only able to fetch few items.
    Please let me know are we missing something ?
    And please let me know the significance of "Assign Items". How to put the same.
    Regards,
    John
    Edited by: 911765 on Mar 14, 2012 4:36 AM

    1) CC won't fetch all items in all classes.
    It will look at only those items that are present in the assign items screen.
    It will only consider those items which have cycle count enabled flag set to Yes in item master
    It will only consider those items that have a non-zero frequency for the ABC class of the item.
    It will only print those items that have some onhand if you run the CC to ignore zero onhand items.
    2) You can either manually add items to a CC in the assign items window.
    OR
    You can reinitialize or update the CC (by going to the 3rd tab on CC screen)
    Make sure that you have run ABC compilation so each item has a ABC class. You should also specify the frequency for each ABC class.
    Sandeep Gandhi

Maybe you are looking for

  • Error in initializing a class of IPC 3.0 application in WAS 6.4

    Hello,      When i trying to run IPC 3.0 application in WAS 6.4. I am getting an error as #1.5#005056A244130043000000020000126800042596C6349F2A#1167229407602#/System/Server/WebRequests#sap.com/ipc_cesar#com.sap.engine.services.servlets_jsp.server.Htt

  • Flash builder 4.5.1 ios build fails with error map failed

    I have built several test app with flash builder 4.5 and now 4.5.1.  I am working on an app for ipad, but when I run a test build it runs for several minutes as if it is going to create the ipa, but then error out and displays the following error mes

  • Pretty Easy Qeustion EWA

    Please anyone can tell me about that :- In solution manager 4.0 for earlyWatch Report need trusted/trusting system ? in SM59 shows these connections  in R3 system like NQA SM_NSMCLNT100_BACK SM_NSMCLNT100_TRUSTED SDCC_OSS SAPOSS SAPNET_RTCC SAPNET_RF

  • Trying to access the java script files via jar file in WEB SERVER

    hi all, I am trying to access the java script files via jar file ,which is present in Apache webserver in order to minimise the number of hits to app server.some thing like cache ... in jsp the code goes like this...      <script type="text/javascrip

  • Many problems installing Quicktime+iTunes

    (Keep in mind I have windows 7 64 bit) I need the firmware update for my iPhone 3g, which normally I avoid because I always seem to have a problem with quicktime installing properly. But since a couple up my apps needed to work, I gave in. When I tri