Hibernate version:
2.1.8 - upgrading to 3.0 in a month or two
Full stack trace of any exception that occurs:
net.sf.hibernate.SQL - select ... from job_queue_run where (int_seq_no=? )
net.sf.hibernate.impl.BatcherImpl - preparing statement
net.sf.hibernate.type.SerializableType - binding null to parameter: 1
net.sf.hibernate.util.JDBCExceptionReporter - SQL Exception
com.ibm.db2.jcc.b.SQLException: The value of input host variable or parameter number "1" cannot be used because of its data type.
at com.ibm.db2.jcc.b.ce.e(ce.java:1093)
at com.ibm.db2.jcc.b.ce.a(ce.java:884)
at com.ibm.db2.jcc.a.bd.n(bd.java:535)
Name and version of the database you are using:
db/2 8.1
The generated SQL (show_sql=true):
select ... from job_queue_run where (int_seq_no=? )
We're developing code to run on (among others) DB/2 and MSSQL. When running an HQL query, sometimes I get the above error because I pass in NULL instead of a, say, String value. This works fine on MSSQL (it allows queries like "where foo = null") but not on DB/2 (it wants something like "where foo IS NULL").
My question is this: is there an easy way, in Hibernate, to get around this?
I'm thinking UserType, but is there something else that I can have Hibernate just do for me?:)
I also realize I could do arguement checking before running the queries - that's also a possibility.
I'm just trying to figure out the best option for my situtation.
Any input would be greatly appreciated!!
Thanks,
Jon
|