Use ViewObject Query Mode for In-Memory Sorting of data in Oracle ADF

Sharing is Caring

Hello All, Hope you are doing good
Previously I have posted about In-Memory filtering of ViewObject by changing ViewCriteria’s query execution mode, Now this post is about In-Memory sorting of records in viewObject. By default sorting and filtering in viewObject works on the rows retrieved from DB. We can change ViewObject Query mode as per our requirement, There are 3 different SQL query mode of the view object and one line description is given below for the basic understanding of default query modes.

QUERY_MODE_SCAN_DATABASE_TABLES – Default query mode of ViewObject, Only rows from the database.

QUERY_MODE_SCAN_VIEW_ROWS – Use the rows in memory (DB n New rows).

QUERY_MODE_SCAN_ENTITY_ROWS – Use entity objects rows, valid for entity-based view objects)

Here I am taking Departments table of HR Schema to prepare the model

Dropped Departments ViewObject as a table on the page and CreateInsert operation as a button

Created a new row with DepartmentId 300 and after sorting on DepartmentId column we can see that only DB records are sorted

For In-Memory sorting of records added a button on the page and created a method in the managed bean that changes VO query mode- performs sorting – execute viewObject


import javax.faces.event.ActionEvent;

import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCIteratorBinding;

import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;

import oracle.jbo.ViewObject;

 * Generic Method to call operation binding
 * **/
public BindingContainer getBindingsCont() {
return BindingContext.getCurrent().getCurrentBindingsEntry();

 * Generic Method to execute operation Binding
 * */
public OperationBinding executeOperation(String operation) {
OperationBinding createParam = getBindingsCont().getOperationBinding(operation);
return createParam;

/**Method to sort in-memory records by changing ViewObject Query Mode
 * @param actionEvent
public void sortUsingDeptIdAction(ActionEvent actionEvent) {
//Get Iterator of Departments table
DCIteratorBinding iter = (DCIteratorBinding) getBindingsCont().get("Departments1Iterator");
//Get ViewObject from iterator
ViewObject vo = iter.getViewObject();
//Change ViewObject query mode
//Perform sorting
vo.setSortBy("DepartmentId desc");
//Execute ViewObject

And after clicking on InMemory Sort button

In-Memory Sorting

Cheers 🙂 Happy Learning

Related Posts

2 thoughts on “Use ViewObject Query Mode for In-Memory Sorting of data in Oracle ADF”

  1. I do not even understand how I ended up right here, but I assumed
    this put up was great. I do not recognise who you’re but certainly you’re going to
    a well-known blogger in the event you are not already.


Leave a Reply

Your email address will not be published. Required fields are marked *