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
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 model
Dropped Departments ViewObject as table on page and CreateInsert operation as 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 page and created a method in managed bean that changes VO query mode- performs sorting – execute viewObject
And after clicking on InMemory Sort button
Cheers 🙂 Happy Learning
I’m an Oracle ACE, Blogger, Reviewer,
Technical Lead working on Oracle ADF