Search This Blog


Saturday, August 13, 2011

ADF: Converting Number to Integer using EL

I spent about 20 minutes looking for this solution today - so I figured I'll just post this entry as a future reminder for myself...
I was using a Web Service data control that has an Integer parameter, and I wanted to get the value of EmployeeId from an ADF BC based ADF Faces table into it using an af:setProperty tag, but I got an error because the engine couldn't convert the jbo Number type to the needed Integer type.
Something like: 
Cannot convert 203 of type class oracle.jbo.domain.Number to class java.lang.Integer
Turns out the solution is quite simple, add a .value to the end of the Number field EL.
So instead of 
                  <af:setPropertyListener from="#{row.EmployeeId}"
use something like:
                  <af:setPropertyListener from="#{row.EmployeeId.value}"
And the conversion just works.