org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error selecting key or setting result to parameter object. Cause: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'com.ng.crossquery.entity.po.QueryMapper.addTemplate!selectKey'. It's likely that neither a Result Type nor a Result Map was specified.
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
报错但是数据插入成功了,但是ID的值插入的是0,而不是序列的值!
第1个回答 推荐于2016-10-15
看你的xml,貌似是order的问题。
order的属性
1:BEFORE,会先选择主键,然后设置keyProperty,再执行insert语句;2:AFTER,就先运行insert 语句再运行selectKey 语句。本回答被提问者采纳
order的属性
1:BEFORE,会先选择主键,然后设置keyProperty,再执行insert语句;2:AFTER,就先运行insert 语句再运行selectKey 语句。本回答被提问者采纳