Saturday, May 21, 2011

oracle.jbo.attributeloadexception: JBO-27022

Problem scenario :

I was in the process of replacing a particular table in the database with a new table (table name and attribute names changed). Correspondingly this involved creating new Entity Object, View Object, Entity Associations and View Object links. This meant replacing the old associations that are present in any of the VOs with the new ones.

As part of this, all required attributes from the EO need to be shuttled properly to be present as part of the VO. The catch here is, if the EO has any transient or calculated attributes, then these should not be shuttled into the VO. If you happen to do this, you are bound to hit the above exception when testing the VO:-

(oracle.jbo.AttributeLoadException) JBO-27022: Failed to load value at index 19 with java object of type java.lang.Long due to java.sql.SQLException.

Solution :
Remove the extra transient attributes (in the VO) that were added from the EO.
The VO test should now pass fine. The number of attributes in the Select clause of the VO object query and the number of attributes in the VO should potentially be the same!

The below link provides some more useful information on the same front :-
http://oracle-hack.blogspot.com/2009_05_01_archive.html