I got a StorageException (ORA-01460) while trying to update string fields in an Oracle 10 database. I tried the same scenario in Sql Server and the in-memory database, no problems there. The error occurs only in very specific circumstances, but I suppose it has something to do with a query parameter that is too small. I made a little app with a very simple model to try some variations. It has a very simple model:
The database is recreated (upgradeMode="Recreate") when the application starts. First, the app create a thousand entities:
Then it tries to change the text field of the entities:
This fails because Oracle says that “the requested conversion is not implemented or unreasonable”. The exception details says why:
Interestingly, the error occurs for i == 10, and at that moment the length of p0_0 changes. . Many variations of this scenario do not fail.
The number of digits of the lowerbound of the loop has to be smaller than the number of digits of the upperbound. There’s also no problem if the loop counts down instead of up: “for (int i = 1000; i >= 1; i--)” Likewise, if we don’t filter on the Text-property but on the Id, it all works well:
Finally, unwinding the loop like this gives an exception (as expected):
But if we replace i, s1 and s2 by constants, it suddenly works:
So, all in all a pretty obscure bug. |
See http://forums.oracle.com/forums/thread.jspa?threadID=507725 "This bug turned out to be a database issue. At this point, the Oracle dev team has put together a fix, but the fix hasn't been merged into a release yet. If you check with Oracle Support in a week, they'll probably know by then which database release will include this fix." |
Thank you for the investigation you've made. That's really weird behavior. Are there anything that could be done by us to get rid of this or at least to minimize the probability of the case? |
Thanks for the quick response. I'll ask the Oracle guys here if they applied all the latest patches. Maybe not... |