nested exception is org.apache.ibatis.executor.ExecutorException: Error getting generated key or setting result to parameter object. Cause: org.apache.ibatis.binding.BindingException: Parameter 'id' not found. Available parameters are [collection, list]
解决方法:
升级版本(mybatis-3.5.6,mybatis-spring-2.0.6)
mybatis自增主键返回不改变xml,只需在原insert标签中添加两个属性,useGeneratedKeys 和 keyProperty将 useGeneratedKeys 设为 true,keyProperty 的值设为数据表对应DO的属性名即可。
springboot集成tkMybatis的步骤:
1、引入TkMybatis的Maven依赖。
2、配置对应实体类(表对应的实体)。
3、Mapper集成tkMybatis的Mapper接口。
4、启动类注解@MapperScan扫描Mapper接口。
5、在application.yml配置文件,指定mapper.xml文件路径。
6、使用TkMybatis提供的sql执行方法。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)