Hibernate, Oracle, Named Query, and Null
I'm sure this is captured in a bunch of FAQs but I thought I'd mention it here so I at least have an easy place to find it in the future. If you have a named query with parameters in Hibernate at some point you will probably run across this error:
Hibernate operation: could not execute query; bad SQL grammar [select table0_.id as id, table0_.version_stamp as version3_90_, table0_.user_id as user4_90_, table0_.confirmed as confirmed90_ from example_table table0_ where table0_.user_id=?]; nested exception is java.sql.SQLException: ORA-00932: inconsistent datatypes: expected NUMBER got BINARY
While the error looks nasty, the most likely cause is that you accidentally passed in a Java null value instead of the expected type. In this case it should have been a Java Long value.
Comments
Posted by: Anonymous | May 16, 2008 9:14 PM
Posted by: Anonymous | June 3, 2008 1:50 PM
Posted by: moman | June 27, 2011 3:51 AM
Posted by: Anonymous | July 28, 2011 12:47 PM