ADF, JDeveloper

JBO-26041: Failed to post data to database during “Update”… What might be the reason?

Problem:

Exception during data save is thrown:

oracle.jbo.DMLException: JBO-26041: Failed to post data to database during “Update”: SQL Statement “UPDATE…

It might be followed by similar to this one:

java.sql.SQLException: Fail to construct descriptor: Unable to resolve type “NVARCHAR2″…

Solution:

Check if  SQLType attribute of an entity/view object attribute being updated is correct. For example it can be set to “STRUCT” when “VARCHAR” is necessary.


Comment:

Sometimes framework generates wrong type here. For example when adding new NVARCHAR2 column into entity, JDeveloper generates new custom datatype domain (i.e. Nvarchar2). Usually it is not necessary unless you really want to implement there something custom. But in most cases standard String fits well. So you tune newly added attribute to be of type String, everything then looks fine and works fine untill data update does not become necessary. And then you get exception noted above. Thats because Jdeveloper did not tune all necessary attributes for entity object attribute. It left SQLType unchanged and set to “STRUCT”. So in this case after manual change to SQLType=”VARCHAR” problem was solved. This applies either to entity and view objects.
However this exception is a generic one and there can be a plenty of reasons to get it. But this is one of those. Check out if its not your case. Good luck!

JDeveloper version 12.1.3.0.0