Use of Oaviewobject in ClearCache (), Reset (), Setmaxfetchsize (-1)

Source: Internet
Author: User

Today after the page jump, clearly executed the query, and the query statement is correct, the page does not display data, and click Submitbutton Package Browser back exception.

The code is as follows:

    Oaviewobjectimpl vo= (Oaviewobjectimpl) am.findviewobject ("XXXVO1");         vo. ExecuteQuery (Headerid);                Public void ExecuteQuery (number Headerid)    {        clearcache ();        Setwhereclauseparams (null);        Setwhereclauseparam (0, Headerid);        ExecuteQuery ();    }

Print Log discovery:
Vo.getmaxfetchsize () ==0;

Vo.getfetchrowcount () ==0;

Therefore, the page does not display data and triggers the post data, causing the browser to back out of the exception.

The code is modified to look as normal.

    Oaviewobjectimpl vo= (Oaviewobjectimpl) am.findviewobject ("XXXVO1");    Vo.clearcache ();     Vo.reset ();    Vo.setmaxfetchsize (-1);    Vo. ExecuteQuery (Headerid);                Public void ExecuteQuery (number Headerid)    {        clearcache ();        Setwhereclauseparams (null);        Setwhereclauseparam (0, Headerid);        ExecuteQuery ();    }

This has made me

    Vo.clearcache ();     Vo.reset ();    Vo.setmaxfetchsize (-1);

Use the VO reset and clear cache both in the Processformrequest before redirecting to page again as well as in processrequ EST before initializing the VO.

But, why???

These three methods generate a strong interest.

Query Jdev Doc Gets the following results:

The official documentation on the ClearCache () method is described below:

ClearCache
public void ClearCache () Clears the View object cache.
This method can be called for resource conservation. Calling this method also forces a automatic re-execution of the query for all rowsets, which refreshes the cache from the Database.


Specified by:
ClearCache in Interface ViewObject
Overrides:
ClearCache in class Oajboviewobjectimpl

About the Reset () method is not yet found in the document description.

The official documentation for Setmaxfetchsize () is described below:

Setmaxfetchsize
public void setmaxfetchsize (int size) Maximum number of rows to fetch when a query is executed. This number takes effect the next time a query is executed.
Passing '-1 ' would retrieve all the rows. This is the default behavior. (For OA Framework view objects, however, OA framework initializes the maximum fetch size to being the value specified by "Vo_ Max_fetch_size "profile option value".)

Passing ' 0 ' would result in the database query isn't being executed and also mark the View object as properly prepared for QU ery execution.

Specified by:
setmaxfetchsize in interface ViewObject
Overrides:
setmaxfetchsize in class Viewobjectimpl
Parameters:
size-maximum number of rows to fetch
See Also:
executeQuery (), Ispreparedforexecution (), Setpreparedforexecution (Boolean flag)

Use of Oaviewobject in ClearCache (), Reset (), Setmaxfetchsize (-1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.