Sorting: TransientVO Vs Query/EO based VO

Posted by Vijay Mohan on Oracle Blogs See other posts from Oracle Blogs or by Vijay Mohan
Published on Tue, 01 Jun 2010 17:28:52 +0000 Indexed on 2010/06/01 17:54 UTC
Read the original article Hit count: 615

Filed under:
In ADF, you can do a sorting on VO rows by invoking setSortBy("VOAttrName") API, but the tricky part is that, this API actually appends a clause to VO query at runtime and the actual sorting is performed after doing VO.executeQuery(), this goes fine for Query/EO based VO. But, how about the transient VO, wherein the rows are populated programmatically..?

There is a way to it..:)

you can actually specify the query mode on your transient VO, so that the sorting happens on already populated VO rows.

Here are the steps to go about it..

//Populate your transient VO rows.
//VO.setSortBy("YourVOAttrName");
//VO.setQueryMode(ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
//VO.executeQuery();

So, here the executeQuery() is actually the trigger which calls for VO rows sorting.
QUERY_MODE_SCAN_VIEW_ROWS flag makes sure that the sorting is performed on the already populated VO cache.

© Oracle Blogs or respective owner