这里是错误:
org.springframework.dao.TransientDataAccessResourceException:PreparedStatementCallback; SQL [INSERT INTO组织(公司名称,年份(年份),邮政编码,员工人数,口号)VALUES(?,?,?,?,)];参数索引超出范围(5>数字参数,即4)。嵌套异常为java.sql.SQLException:参数索引超出范围(5>个参数,即4)。
这是我的方法:
public boolean create(Organization org) {
String sqlQuery = "INSERT INTO organization (company_name, year_of_cop, postal_code, employee_count, slogan)"+
"VALUES(?, ?, ?, ?, )";
好像您在查询字符串中缺少最后一个参数占位符:
public boolean create(Organization org) {
String sqlQuery = "INSERT INTO organization (company_name, year_of_cop, postal_code, employee_count, slogan)"+ "VALUES(?, ?, ?, ?, ?)";
...
}