-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: NULLS in generated SQL in DB/2
PostPosted: Thu Mar 24, 2005 5:59 pm 
Newbie

Joined: Fri Oct 03, 2003 8:44 am
Posts: 11
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.