前景提要
HDC调试需求开发(15万预算),能者速来!>>>
大神们,请帮忙看看。添加了 useGeneratedKeys="true" keyProperty="id"到这个SQL中,如下:
<insert id=" add " parameterType="Teacher" useGeneratedKeys="true" keyProperty="id">
dao层方法中使用注解add(@Param(“teacher”) Teacher teacher ),在调用时,就报错。如下:
org.mybatis.spring.MyBatisSystemException: 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 [telecomOrder, param1]
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364)
at com.sun.proxy.$Proxy17.insert(Unknown Source)
为什么会把 keyProperty="id"中的id当做参数?