写一些刚学习mybatis遇到的异常
Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'user' in 'class com.entity.User'
### The error may involve com.mapper.UserMapper.addUser-Inline
### The error occurred while setting parameters
### SQL: insert into t_user values (null,?,?,?,?,?,?,?)
### Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'user' in 'class com.entity.User'
第一反应是实体类没有写set/get方法。但是我在代码中集成了lombok插件。
他的意思是说user的实体类没有get方法吗?我检查了一遍我添加了@Data的注解,不应该啊。
我要实现的功能是往数据库表中新增一条记录,userDao如下:
解决方案: