我有以下异常艰难:Spring JDBC和Oracle DB 12c:java.sql.SQLException:列类型无效。为什么?
org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [update EVALUATION_SHEET set STATUS=?, LAST_EDITED=? where id=?]; SQL state [99999]; error code [17004]; Invalid column type; nested exception is java.sql.SQLException: Invalid column type
这是这里抛出:
jdbcTemplate.update("update E_SHEET set STATUS=?, LAST_EDITED=? where id=?",
new Object[]{eSheet.getStatus().ordinal(), eSheet.getLastEditDate(), eSheet.getId()},
new Object[]{OracleTypes.NUMBER, OracleTypes.TIMESTAMP, OracleTypes.NUMBER});
创建数据库表如下:
create table E_SHEET (
ID number not null unique,
ID_POSITION number not null,
STATUS number default 0 not null,
ID_EXAMINER number not null,
LAST_EDITED timestamp not null);
我不知道是什么造成问题。此方法:
eSheet.getLastEditDate()
返回java.util.Date对象。我将Spring Boot和Oracle DB 12c作为数据源使用Spring JDBC模板。
last_edited是一个时间戳,这意味着你将需要使用时间戳对象:'新的时间戳(eSheet.getLastEditDate()的getTime())' – fmodos 2014-12-05 11:13:36
这个例外声明基本上只是说:“我得到了这另一个例外“。邮政*那*一。 – chrylis 2014-12-05 11:14:30