This post is about applying or changing WHERE clause of ViewObject programmatically, it can be also used in case we need a specific data(row) from the database, suppose you are using Department table of HR Schema and on a button click you need to show records of department id 5
It means you want to filter viewObject query result on that particular event, you can do this using setWhereClause method of ViewObjectImpl class.
See the image below, all rows shown in this
Now when we click the button, it will filter (apply WHERE Clause in Departments ViewObject) rows and refresh ViewObject , returns desired rows.
For Department_Id 4-
For Department_Id 5-
This code snippet fetch the Row with Deprartment_id=4 and returns back to page. setWhereClause sets the Query’s (SQL) Where Clause and doesn’t take effect until executeQuery method of ViewObjectImpl is called
To reset Where Clause we have to set null value in method used
An Oracle ACE, Blogger, Reviewer, Technical Lead working on Oracle ADF