Pages - Menu

Friday, September 13, 2013

How to Search in Views - Part 3 || Oracle ADF

After last topic about how to implement Alternate Keys & use findByAltKey to search in View Objects, today we will discuss how to use another way using View Criteria.
View Criteria : it is programmatically or defined where Criteria and its purpose to affect on Where Clause, we can define it in View Objects.
findByViewCriteria : Finds and returns View rows that match the specified View Criteria.
today, i will use a very small example of view criteria without using Bind Variables.
  • create view criteria with Criteria you need with operand = Literal
  • what is structure of findByViewCriteria ?
     findByViewCriteria(ViewCriteria criteria,
                               int maxNumOfRows,
                               int queryMode)
  • as usual, implement impl class of AM, and build piece of cake method to access VC in VO to get the result and put it as Client Interface.
Description :create RowIterator to save returned result, passing VC Name,Max of Expected rows returned (-1 unlimited) & Query Mode ..
If QUERY_MODE_SCAN_VIEW_ROWS is specified, the existing View rows in the current Row Set are scanned for matching rows.
If 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.
If 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.
  • Let us check the result.

Coming topic : we will discuss how to implement Bind Variables inside View Criteria and use findByViewCriteriaWithBindVars instead.

No comments:

Post a Comment