Bits of code related to Oracle's Application Development Framework (ADF). Some of the posts in this blog may seem elementary. They are. Nevertheless, you will be amazed to find out how many beginner ADF practitioners are struggling with basic concepts and sample code. Hopefully they will find some here.
Tuesday, March 30, 2010
Bit #2 - Setting a bind variable value programmatically
To set the value of a bind variable programmatically, you will need to first get the View Object where the bind variable is defined. Then from the View Object you need to get access to the VariableValueManager via the call ensureVariableManager(). Finally you need to call setVariableValue() on the VariableValueManager to set the bind variable to a specific value. Once all these are done, execute the View Object query with the new bind variable value by calling executeQuery() on the view as shown below.
ViewObjectImpl view = this.getSomeView(); VariableValueManager vm = view.ensureVariableManager(); vm.setVariableValue("bindVariableName", value);
Application Module Implementation class
View Object Implementation class