2 Replies Latest reply on Sep 9, 2013 9:22 PM by cjones

    Applied ViewCriteria not being added to query




      I have a ViewCriteria that is supposedly being applied to a ViewObject, but I am getting a "Attempt to set a parameter name that does not occur in the sql" error.  I know that the ViewCriteria is being applied, but for some reason, the 'criteria' in the ViewCriteria is not being added to the query that is being sent to the database.


      Here is the method where the error is occuring:

      public List<SelectItem> getCategorySelectItems()
              categorySelectItems = new ArrayList<SelectItem>();
              BindingContainer bindings = ADFUtils.getBindingContainer();
              DCIteratorBinding dcIteratorBinding = (DCIteratorBinding) bindings.get(ITERATOR_NAME_CATEGORY_SITEID_PHASEID);
              MytrainCategoriesVOImpl mytrainCategoriesVO = (MytrainCategoriesVOImpl) dcIteratorBinding.getViewObject();
              ViewCriteriaManager vcm = mytrainCategoriesVO.getViewCriteriaManager();
              String[] vcs = vcm.getApplyViewCriteriaNames();
              for(String vcname : vcs){
                  logger.finer("Applied ViewCriteria: " + vcname);
                  MytrainCategoriesVORowImpl mytrainCategoriesVORow = (MytrainCategoriesVORowImpl) mytrainCategoriesVO.next();
                  SelectItem newSelectItem = new SelectItem(mytrainCategoriesVORow.getCategoryId(), mytrainCategoriesVORow.getTitle());
              return categorySelectItems;


      The debugging piece where I write out the getApplyViewCriteriaNames() shows that both the "site_id" and "phase_id" criteria are being applied, but the SQL query that is sent to the server does not contain the "where phase_id = :bind_PhaseId" section, even though the query DOES contain the "where site_id = :bind_SiteId" section.


      Any ideas why it would be applying one ViewCriteria and not the other, even though the ViewCriteriaManager says that both criteria are being applied?