Adding a dynamic where clause using positional parameters
The following piece of code shows how to add a dynamic where clause to a view object .
It also shows how to set the bind parameters (using the positioning style not the named bind parameters)
public void addWhereClause(){
ViewObject vo=this.getEmp1();
vo.setWhereClauseParams(null);
vo.setWhereClause(null);
vo.setWhereClause("Empno=:1");
vo.setWhereClauseParam(0,new Integer("7369"));
// you can also use the following code to set the positional parameters.
// vo.setWhereClauseParams(new Object[]{new Integer("7369")});
//
// The difference between the two apis is that one explicitly provides
// the bind parameter position and in the second one the position is implicity
vo.executeQuery();
vo.setWhereClauseParams(null);
vo.setWhereClause(null);
}
Using the "setWhereClauseParam" or "setWhereClauseParams" api's you cannot set the named bind parameters....