Tuesday, June 19, 2012

ExecuteWithParams in ADF 11g

A small post after a long time regarding "ExecuteWithParams"  operation with VO. Most of the time, since coming from OAF background I usually write small methods in AM implementation class and expose it to view controller layer using interface and then drag and drop it as a binding layer in my ADF page.

 But recently was struck, when tried to ease my work using ExecuteWithParams drag and drop directly and assign the bind variable value from pageFlowScope.I worked for almost 4 hours tried all sorts of debugging but everytime when my bounded taskflow reaches executewithparams activity , i use to get error code like :
JBO 27122 error and the exception message like "Missing IN or OUT parameter at index:: 1 " error.

Generally happens with me :) , whenever try to ease my work , some innovative error  comes in... ! But anyways after a careful review of the VO xml files and comparing with old code where I have used this operation many times I came to the conclusion : There are two kinds of bind variables: "where" and "viewcriteria". While editing my viewobjects I accidentally created a variable of the kind "viewcriteria", which means that it cannot be used in the where clause of the sqlquery, but only in a viewcriteria. When you create a "where" variable, you are allowed to use it in the where clause of your query.This all makes sense, but the GUI for editing the variables does NOT show the difference.

So if you run into the error above, look inside the XML of your viewobject for your variable and if you see Kind="viewcriteria", then change it to Kind="where" and try again and  your code should work fine.