stressball
Programmer
I am getting data from a ResultSet and putting it into a Hashtable. My problem is that some of the fields I am getting back are null, but I still need them. I would like to change them to an empty String, currently I am doing this but I would like to create a method to test if there is a null field in the ResultSet and set it to an empty String. I need to do this without specifying a column name as there are many columns and many could be null. Here is an example of one of the many if statements I currently have:
Hashtable finalContentHash = new Hashtable();
P_Content_Read contentRead = new P_Content_Read();
ResultSet rs = contentRead.getData(content_id);
String handleNull = "";
if (rs.getObject(DEFAULT_FILE)!=null) {
finalContentHash.put(DEFAULT_FILE_TITLE,rs.getObject(DEFAULT_FILE)); } else
finalContentHash.put(DEFAULT_FILE_TITLE,handleNull);
Can somebody help me?! I would like to use column numbering eg
loop through resultset checking for nulls and replacing them with "" but I can't seem to get it working.
Your help will be most appreciated.
Hashtable finalContentHash = new Hashtable();
P_Content_Read contentRead = new P_Content_Read();
ResultSet rs = contentRead.getData(content_id);
String handleNull = "";
if (rs.getObject(DEFAULT_FILE)!=null) {
finalContentHash.put(DEFAULT_FILE_TITLE,rs.getObject(DEFAULT_FILE)); } else
finalContentHash.put(DEFAULT_FILE_TITLE,handleNull);
Can somebody help me?! I would like to use column numbering eg
loop through resultset checking for nulls and replacing them with "" but I can't seem to get it working.
Your help will be most appreciated.