1. 程式人生 > >myBatis的binding錯誤:Invalid bound statement (not found)

myBatis的binding錯誤:Invalid bound statement (not found)

per HERE state gui bean ESS dao 錯誤 java

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)錯誤
這個問題我找了好久,終於找到了
正確的寫法:
<select id="getEmpByIdAndLastName" resultType="com.atguigu.mybatis.bean.Employee">
select id, last_name, gender, email from tbl_employee where id = #{id} and last_name = #{last_name}
</select>
錯誤的寫法:
<select id="getEmpByIdAndLastName" resultType="com.atguigu.mybatis.bean.Employee">
select * from tbl_employee where id = #{id} and last_name = #{last_name}
</select>


Mapped Statements collection does not contain value for com.atguigu.mybatis.dao.DeparmentMapper.getDeptById

Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property=‘__frch_emp_0.last_name‘, mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId=‘null‘, jdbcTypeName=‘null‘, expression=‘null‘}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).

myBatis的binding錯誤:Invalid bound statement (not found)