Object value = entry.getValue();
// Debug message
- this.getLogger().debug(MessageFormat.format("value={0}", value));
+ this.getLogger().debug(MessageFormat.format("value={0} - BEFORE!", value));
- // Add value
- valueQuery.append("?,");
- values.add(value);
+ // Handle possible empty->null convertion
+ value = this.getFrontend().emptyStringToNull(entry.getKey(), value);
+
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("value={0} - AFTER!", value));
+
+ // Is the value null?
+ if (value == null) {
+ // Add null
+ valueQuery.append("NULL,");
+ } else {
+ // Add value
+ valueQuery.append("?,");
+ values.add(value);
+ }
}
// Now put all together
* @author Roland Haeder
*/
public interface DatabaseFrontend extends FrameworkInterface {
+ /**
+ * Depending on column, an empty value may be converted to null
+ *
+ * @param key Key to check
+ * @param value Value to check
+ * @return Possible previous value or null
+ */
+ public Object emptyStringToNull (final String key, final Object value);
+
/**
* Gets a Result back from given ResultSet instance
*