Search this blog

PL/SQL Tutorial - What is PL/SQL, Features and Advantages of PL/SQL

PL/SQL is developed by Oracle Corporation to increase/enhance capabilities of SQL, PL/SQL stands for P rocedural L anguage extension to SQ...

Monday, 15 April 2013

Creating and Executing ViewCriteria Programmatically

Sometimes you need dynamic ViewCriteria that you can handle at runtime ,
here is the solution ,you can create and apply ViewCriteria Programmatically-

Sample UseCase-
  • Suppose you have Department VO
  • You want to filter this VO for DepartmentId 10
  • Do this using this code snippet

  • /**Get ViewObject*/
    ViewObject vo = getAm().getDepartments1();
    /**Create ViewCriteria on ViewObject*/
    ViewCriteria vc = vo.createViewCriteria();
    /**Create ViewCriteriaRow for that Criteria*/
    ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
    /**Set the values for ViewCriteriaRow*/
    vcRow.setAttribute("DepartmentId", 10);
    /**Add row to ViewCriteria*/
    /**Apply Criteria on ViewObject*/
    /**Execute ViewObject*/

    public pcAMImpl getAm() {
    pcAMImpl am = (pcAMImpl)resolvElDC("pcAMDataControl");
    return am;


  1. Hi,

    Not Understand below method. Can you please explain or share some screenshot..

    public pcAMImpl getAm() {
    pcAMImpl am = (pcAMImpl)resolvElDC("pcAMDataControl");
    return am;

    1. Dinesh

      This is the way to get ApplicationModule in managed bean and pcAMImpl is the name of application module impl class
      but don't use this way of calling method instead see How to invoke model layer methods from managed bean (Best Practice to write business logic in ADF)