The query being ran was a simple fetch query along the lines of:
Basically, there was nothing to indicate that there was a numeric value that was being populated with a null string.
So where did the error come from?
I threw together a quick code example to demonstrate how the error occurred.
It's dependent on two entities for Art and Artist:
and flushAtRequestEnd = false (which is generally a good idea).
So, If you run this, it will toss an error. The same error that I was getting at work. That is:
The basics of what is happening is that around the line where this occurs: updatePrice( randomArt, "" ); We are setting an integer value to an empty string. As stated in the code, this is _NOT_ a database null value. If we had used javacast( "null", 0 ) instead, it would not have tossed an error. NULL is a valid value. "" is not. Also, you can't pass a javacast null into a function and have it recognize it. So, if we had written the function this way:
it would have worked just fine.
However, because of the way ORM sessions work, nothing is really happening there. Even when it saves in the updatePrice() method, nothing is really happening because it won't get committed until you explicitly commit it using a transaction somewhere or calling ormFlush(). Then, and only then will it try to persist that data to the database.
So, when we start our orm transaction in the save method, it goes to commit and persist the bad data. However, it can't. It's expecting an integer and it's getting an empty string. So it throws an error. However, because the error didn't _technically_ occur until that transaction, it gives that code block for where the error is occurring.
Sorry if this is a little hard to follow. I'm new to explaining some of these issues to people. The takeaway is that you need to be mindful of how that data is really persisting over to the database. Thankfully, with CF 10, the error messages get a little better:
Wow! Property names! That's actually a _huge_ improvement over where things were before. That is definitely helpful in the troubleshooting process.
tl;dr - Orm session troubleshooting can be a headache. Better brush up on how they work.
For more explinations, see:
Adobe's docs and A good post by Mark Mandell