Thursday, April 7, 2016

ADF BC View Criteria Query Execution Mode = Both

View Criteria is set to execute in Database mode by default. There is option to change execution mode to Both. This would execute query and fetch results from database and from memory.  Such query execution is useful, when we want to include newly created (but not commited yet) row into View Criteria result. Newly created row will be included into View Criteria resultset.

Download sample application - JobsView in sample application is set with query execution mode for View Criteria to Both:

I'm using JobsView in EmployeesView through View Accessor. If data from another VO is required, you can fetch it through View Accessor. View Accessor is configured with View Criteria, this means it will be automatically filtered (we only need to set Bind Variable value):

Employees VO contains custom method, where View Accessor is referenced. I'm creating new row and executing query with bind variable (primary key for newly created row). View Criteria is set to execution mode Both, this allows to retrieve newly created row (not commited yet) after search:

View Criteria execution mode Both is useful, when we want to search without loosing newly created rows.


Unknown said...

Hy Andrejus!
I am seeking for help on a scenario not related to this Blog though
I am creating an application and I have configure security that authenticate a user and directs him to home page successfully. Now In my DB I have data about two different locations which I refer as segments i.e segment 1 and 2... Now my requirement is that when user logged in and provide his/her segment that will be either 1 or 2, only data about that segment should appear on screen. Is there anyway to achieve this functionality? Any help please?
Advance Thanks :)

Unknown said...

Hi Andrejus,
This doesn't work with me, my scenario is:
1 - i created a view criteria on view object and set query execution mode to "Both"
2 - i added instance of the view object to the application module
3 - i applied the view criteria to that instance on the application module
4 - i get that instance from the application module programmatically in MB

public String createRequest() {
ViewObjectImpl smcStudentOutpatientRequestU1 =
RowImpl smcStudentOutpatientRequestU1Row =
(RowImpl) smcStudentOutpatientRequestU1.createRow();
smcStudentOutpatientRequestU1.ensureVariableManager().setVariableValue("vRequestId", smcStudentOutpatientRequestU1Row.getAttribute("RequestId"));
// smcStudentOutpatientRequestU1.setNamedWhereClauseParam("vRequestId", smcStudentOutpatientRequestU1Row.getAttribute("RequestId"));
return null;

is there any thing wrong i did
am using Jdeveloper

Thanks in advance