I am using dateField with allowBlank = true because it is no mandatory to fill this field in the form. But when i click save I get an error : save Failed, sql error:PreparedStatementCallback; uncategorized SQLException for SQL [ INSERT INTO tableName (....) VALUES ( .....) ]; SQL state [null]; error code [17004]; Invalid column type; nested exception is java.sql.SQLException: Invalid column type.
Hello,
how can i insert a null value for a datefield in oracle database....
i've used Date d = new Date(java.sql.Types.NULL);
if (...) {
sql = "INSERT INTO tableName( a, b, c, date) values (?, ?, ?, ?)";
params = new Object[] {.... ,
.... ,
.... , (var.getaDate()==null)?d:var.getaDate() };
}
else{
.... }
try {
jdbcTemplate.update(sql, params);
return 0;
} catch (Exception ex) {
log.error("save() Failed, sql error:" + ex.getMessage());
return -1;
}
using Date d = new Date(java.sql.Types.NULL); i get the date Jan 1, 1970 whenthe var.getDate()==null
Thanks in advance !!!
Best regards