db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomcat Programmer <tcprogram...@yahoo.com>
Subject nulls in prepared statement
Date Wed, 20 Jul 2011 02:42:45 GMT
Hi Everyone, 

I've tried doing research on this on the web but can't seem to find a clear answer, I hope
someone can help.  I'm currently working on an application using Derby where the data being
entered is optional for a lot of the fields. The columns in the tables are defined using VARCHAR
data type and accept nulls.  If, in the code to do the insert or update,  someone leaves
a field empty in the application it will result in a null value being passed through setString
method like this: 


where the getPartNo() method returns null.  When this happens I get a null pointer exception.
 Is there a configuration parameter for Derby to accept Java nulls and treat them as SQL
nulls?   If not, the code is going to get incredibly ugly fast if each value has to be checked
for null and then issue a separate setNull() method call.  

Thanks in advance,

View raw message