oracle.jbo.domain.DataCreationException: JBO-25009 while using multiple selection component in ADF Faces

Sharing is Caring

Previously I have posted about using multi-selection components (af:selectManyCheckbox, af:selectManyChoice, af:selectManyListbox, af:selectManyShuttle) of ADF Faces. These components make use of list binding and work on base attribute and display attribute concept and this post is about a problem that user may face while working with these components – JBO-25009


Blog readers mentioned that they are not able to use string value as the base attribute in multi-select components so I have checked same in JDeveloper 12.1.3
I have created selectManyCheckbox component using Departments table of HR Schema with this configuration

JBO-25009
On running this, it throws an error
oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:java.lang.Integer from type:java.lang.String with value:IT
 
Here IT is selected department now if we use DepartmentId as base attribute then it works smoothly but in that case, this code returns DepartmentId not name
So to get selected DepartmentName while using DepartmentId as base attribute we need to do a small change in code and component configuration is this

Changed Bean Code to get value-

 

import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.binding.BindingContainer;

import oracle.jbo.Row;
import oracle.jbo.ViewObject;
import oracle.jbo.uicli.binding.JUCtrlListBinding;

/**Generic Method to get BindingContainer of current page,
* fragment or region**/
public BindingContainer getBindingsCont() {
return BindingContext.getCurrent().getCurrentBindingsEntry();
}

/**Method to get selected value and description from multiselect component
* @param actionEvent
*/
public void getValue(ActionEvent actionEvent) {

//Get Binding Container of Page
BindingContainer bc = this.getBindingsCont();
//Get multiselect component binding from pagedef
JUCtrlListBinding listBindings = (JUCtrlListBinding) bc.get(“DepartmentsVO11”);
//Get Selected Values (It’ll return base value that is DepartmentId)
Object str[] = listBindings.getSelectedValues();

//Get Iterator of listbinding
DCIteratorBinding iter = (DCIteratorBinding) getBindingsCont().get(“DepartmentsVO1Iterator”);
//Get ViewObject instance from iterator
ViewObject deptVo = iter.getViewObject();

//Iterate over selected values
for (int i = 0; i < str.length; i++) {
System.out.println(“Department Id- “ + str[i]);
//Filter ViewObject using DepartmentId
Row filteredRows[] = deptVo.getFilteredRows(“DepartmentId”, str[i]);
//Get DepartmentId from filtered row
if (filteredRows.length > 0) {
System.out.println(“Department Name- “ + filteredRows[0].getAttribute(“DepartmentName”));
}
}
}

Now run and check application

On button click-

Cheers 🙂 Happy Learning

Related Posts

I’m an Oracle ACE, Blogger, Reviewer,
Technical Lead working on Oracle ADF

0 thoughts on “oracle.jbo.domain.DataCreationException: JBO-25009 while using multiple selection component in ADF Faces”

Leave a Reply

Your email address will not be published. Required fields are marked *