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!

ADF BC : setNamedWhereClauseParam() on detail ViewObject

Jan VerveckenMar 27 2006 — edited Mar 31 2006
hi

Using JDeveloper 10.1.3.0.4, I have some trouble setting a named where clause parameter on a "detail" ViewObject.
I have an ApplicationModule (DetailSubsetService) with two instances of the same ViewObject (EmpsInMonth) that has a bind variable (vHireMonth). The ViewObject instances are "AllEmpsInMonth" and "EmpsInMonthForDept".

In the sample application below, I try to change the bind variable value using setNamedWhereClauseParam() on a ViewObject instance. The default for "vHireMonth" is "05".
System.out.println("DetailSubsetStuff.main() : begin");
String vAppModuleDef = "poc.detailsubset.services.DetailSubsetService";
String vConfig = "DetailSubsetServiceLocal";
ApplicationModule vAppModule =
	Configuration.createRootApplicationModule(vAppModuleDef, vConfig);

ViewObject vAllEmpsInMonth = vAppModule.findViewObject("AllEmpsInMonth");
vAllEmpsInMonth.setNamedWhereClauseParam("vHireMonth", "02");
while (vAllEmpsInMonth.hasNext())
{
	EmpsInMonthRow vEmpsInMonthRow = (EmpsInMonthRow)vAllEmpsInMonth.next();
	System.out.println("vEmpsInMonthRow info = "
		+ vEmpsInMonthRow.getEname()
		+ ", " + vEmpsInMonthRow.getHiredate()
		+ ", " + vEmpsInMonthRow.getDeptno());
}

ViewObject vEmpsInMonthForDept =
	vAppModule.findViewObject("EmpsInMonthForDept");
System.out.println("vEmpsInMonthForDept = " + vEmpsInMonthForDept);
vEmpsInMonthForDept.setNamedWhereClauseParam("vHireMonth", "12");

ViewObject vDeptView = vAppModule.findViewObject("DeptView");
while (vDeptView.hasNext())
{
	DeptViewRow vDeptViewRow = (DeptViewRow)vDeptView.next();
	System.out.println("vDeptViewRow info = "
		+ vDeptViewRow.getDeptno() + ", " + vDeptViewRow.getDname());
	RowIterator vEmpsInMonthRI = vDeptViewRow.getEmpsInMonth();
	while (vEmpsInMonthRI.hasNext())
	{
		EmpsInMonthRow vEmpsInMonthRow =
			(EmpsInMonthRow)vEmpsInMonthRI.next();
		EmpsInMonthRowImpl vEmpsInMonthRowImpl =
			(EmpsInMonthRowImpl)vEmpsInMonthRow;
		System.out.println("-- vEmpsInMonthRowImpl.getViewObject() = " +
			vEmpsInMonthRowImpl.getViewObject());
		System.out.println("-- vEmpsInMonthRow info = "
			+ vEmpsInMonthRow.getEname()
			+ ", " + vEmpsInMonthRow.getHiredate()
			+ ", " + vEmpsInMonthRow.getDeptno());
	}
}

Configuration.releaseRootApplicationModule(vAppModule, true);
System.out.println("DetailSubsetStuff.main() : end");
This results in output like:
DetailSubsetStuff.main() : begin
vEmpsInMonthRow info = ALLEN, 1981-02-20, 30
vEmpsInMonthRow info = WARD, 1981-02-22, 30
vEmpsInMonthForDept = poc.detailsubset.dataaccess.EmpsInMonthImpl@2b
vDeptViewRow info = 10, ACCOUNTING
vDeptViewRow info = 20, RESEARCH
-- vEmpsInMonthRowImpl.getViewObject() = poc.detailsubset.dataaccess.EmpsInMonthImpl@2f
-- vEmpsInMonthRow info = ADAMS, 1987-05-23, 20
vDeptViewRow info = 30, SALES
-- vEmpsInMonthRowImpl.getViewObject() = poc.detailsubset.dataaccess.EmpsInMonthImpl@2f
-- vEmpsInMonthRow info = BLAKE, 1981-05-01, 30
vDeptViewRow info = 40, OPERATIONS
DetailSubsetStuff.main() : end
There seems to be no problem for the ViewObject instance "AllEmpsInMonth".
For the ViewObject instance "EmpsInMonthForDept", I try to bind the value "12", but the default value "05" stays in effect.
From the output it is clear that for the same ViewObject instances a different Java object instance gets used when accessed using the method getEmpsInMonth() on the master row. If I'm correct this is intended ADF BC framework behaviour.
My question is ...
How do I set a value for a named where clause parameter on such a detail ViewObject?

If I run the DetailSubsetService in the Oracle Business Component Browser there is no problem changing the value for the bind variable in this detail ViewObject instance. I gues this is because the BC Browser shows master-detail relations based on iterators it gets from the source and destination of a ViewLink instance. I don't think I can use a similar approach because I really want to use the getEmpsInMonth() method on a master row because I want to pass the master row into a VelocityContext so I can approach it using the Velocity Template Language.

thanks
Jan Vervecken
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 28 2006
Added on Mar 27 2006
6 comments
6,791 views