Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to set dynamic WHERE clause to VO from backingBean?

509360Jan 27 2010 — edited Jan 31 2011
Hi,

Can any one let me know the best way to add the dynamic WHERE clause in to VO query.

I have created AM (with AMImpl.java) & VO (with VOImpl.java & VORowImpl.java) in my model project. I suppose to set the WHERE condition at runtime while the user click the search button. I am handling the user button click at UI layer backingBean. From the backing bean I could able to get the objct of the VO and set the where clause by below code.
        ValueExpression valueExp = elFactory.createValueExpression(elContext, "#{bindings.UserSearchVO1Iterator}", Object.class);
        DCIteratorBinding dcIter = (DCIteratorBinding)valueExp.getValue(elContext);
        ViewObject userSearchVO = dcIter.getViewObject();
        userSearchVO.setWhereClause("lower(usr_login) LIKE ':1' and usr_udf_suid like ':2' ");
        userSearchVO.executeQuery();
But as I fear this is not the right way to do it. So I am creating the cutom method inside the VOImpl.java and triggring that method by creating one more cutom method in AMImpl.java. But I dont know how to invoke this AM method from backingBean.
AMImpl method
   
 public void initDetails()
      {
        UserSearchVOImpl vo = getUserSearchVO1();
        vo.initQuery();
     
      }

VOImpl method

    public void initQuery()
    {
        setWhereClause("lower(usr_login) LIKE 'a%' and usr_udf_suid like '%1144%'");
        executeQuery();
    }
Can any one guide me which is the best way to set the where clause to VO? How to call the AM method from backingBean?

Thanks
kln
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 28 2011
Added on Jan 27 2010
11 comments
4,672 views