java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
[Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
### The error may exist in com/ws/dao/DepartmentDao.java (best guess)
### The error may involve com.ws.dao.DepartmentDao.selectById
### The error occurred while handling results
### SQL: SELECT id,dep_address,dep_name FROM department WHERE id=?
### Cause: java.lang.IndexOutOfBoundsException: Index: 3, Size: 3] with root cause
错误分析:在实体类中使用lombok注解,但未提供所有参数的构造函数。
必须包含不带参数的构造方法 或 和查询语句返回的字段数相应的参数的构造方法。
解决办法:
1.添加注解
@NoArgsConstructor
@AllArgsConstructor
2.添加无参构造
public 类名(){
}
例: