Main | Calculated Columns cannot be Updateable - ADF 10.1.3.3 »

MultiSelect on Read Only View Object Tables - ADF 10.1.3.3

View object query created with "Updatable Access through Entity Object option" checked
Can use below code to access selected attribute values of the multiSelect table.

DCIteratorBinding depIter =
ResultADFUtils.findIterator("TableIterator");
RowSetIterator depRSIter = depIter.getRowSetIterator();
RowKeySet selection = this.getTable().getSelectionState();
Set keySet = selection.getKeySet();
Iterator itr = keySet.iterator();

while (itr.hasNext()) {
Key key = (Key)itr.next();
ViewRowImpl row = (ViewRowImpl)depRSIter.getRow(key);
wherePart += row.getAttribute(0);
}

Above code does not work for View Object query created with "Read Only Access" Option checked. You may notice exception as shown below.

"Caused by: javax.faces.el.EvaluationException: java.lang.ClassCastException: java.lang.Integer at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:150) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92) ... 29 "

Altering code as shown below fixes exception.

DCIteratorBinding depIter =
ResultADFUtils.findIterator("TableIterator");
RowSetIterator depRSIter = depIter.getRowSetIterator();

RowKeySet selection = this.getTable().getSelectionState();
Set keySet = selection.getKeySet();
Iterator itr = keySet.iterator();

while (itr.hasNext()) {
String x = itr.next().toString();
int y = Integer.parseInt(x);
Row row = depRSIter.getRowAtRangeIndex(y);
wherePart += row.getAttribute(0);
}


TrackBack

TrackBack URL for this entry:
http://blogs.oracle.com/mte1521/mt-tb.cgi/5461

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on July 17, 2008 11:13 PM.

The next post in this blog is Calculated Columns cannot be Updateable - ADF 10.1.3.3.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle