after my last topic about how to use findByViewCriteria to search in View Objects based on View Criteria, today i will discuss how to use findByViewCriteriaWithBindVars to search in View objects based on View Criteria & Binding Variables ..
public RowIterator findByViewCriteriaWithBindVars(ViewCriteria criteria, int maxNumOfRows, int queryMode, Variable vars, java.lang.Object values)
Description : the functionality of findByViewCriteriaWithBindVars same as findByViewCriteria, but the difference is “findByViewCriteriaWithBindVars access Binding Variables exist in View Criteria to pass values.
i will start my simple example as below ..
1- Create test project & implement impl class of AM to include the new function.
2- Create View Criteria with binding Variable as below.
3- build your new method in AM imp class ..
Description :- Define RowIterator to save the result, passing variableimpl and, Expecting Returning Unlimited No of Rows (-1), but we know that expected value is only one & activating using skipwhere to skip using where clause of VO.
QUERY_MODE_SCAN_VIEW_ROWS is specified, the existing View rows in the current Row Set are scanned for matching rows.
QUERY_MODE_SCAN_ENTITY_ROWS is specified, the Entity cache is searched for qualifying rows. If qualifying rows are found, they are added to the current Row Set. I.e., they become part of the current row collection. Internally, a finder View Object is created to search the Entity cache and to produce View rows from the Entity cache.
QUERY_MODE_SCAN_DATABASE_TABLES is specified, a database query is issued to find matching rows. The View Criteria is converted into a where-clause.
4- Make your method as a client interface as usual in AM Level .
5- result ..