Apply Criteria to Child VO When Parent VO is Executed
User108Mar 20 2013 — edited Apr 1 2013I am using Jdev 11.1.1.3
I have a Parent VO and Child VO with a view Link associated between them.
I have a Search Page with 4 Search Parameters which 2 from the Parent VO and 2 from the Child VO. From the AM Data Control, I have dropped the Parent VO and the Child VO associaed with it as 2 different tables.
My question is when the user inputs in value for the Child VO, and then when I execute Query on the Parent VO, I want the criteria to be applied to the Child VO.
I tried to override the executeQueryForCollection in my Parent VO , obtained the viewlink from the Parent VO, then obtained the Destination ( which is my Child VO ) and set the bind parameters.
So my Code looks like
public void executeQueryForCollection(Object qc, Object[] params,
int noUserParams)
{
ViewLinkImpl viewLinkImpl = null;
ViewLink vlu[] = this.getViewLinks();
String vluNames[] = new String[vlu.length];
for (int j = 0; j < vlu.length; j++)
{
vluNames[j] = vlu[j].getName();
if (vluNames[j].equals("ViewLinkName"))
{
viewLinkImpl = (ViewLinkImpl) vlu[j];
break;
}
}
ChildVOImpl childVOImpl = (ChildVOImpl) viewLinkImpl.getDestination();
childVOImpl.setBindXXX("Value");
childVOImpl.setBindYYY("Value");
super.executeQueryForCollection(qc, params, noUserParams);
}
However what happens is that when I run it, I get an exception "Missing IN or OUT parameter at index:: 1 " Because if I print the query for ChildVO , i see .
Select * from Child Table where FiledName1 = :BindXXX and FieldName2 = :BindYYY and FieldName3= :BindAnotherID
This BindAnotherId is coming from the where Clause attached to the ViewLink .
I expected the framework to have the value for BindAnotherID, since BindAnotherID is the Field with which ParentVO and ChildVO are associated.
Can somebody please throw some light on this or if you know of any other approach to meet the requirement of executing a criteria in Child VO when parent VO is executed as well is appreciated. Thanks in Advance.