MyBatis的常见错误
MyBatis
1.Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for
- 错误:匹配不了
- 原因:配置文件中的id方法名和dao接口中的方法名不一致
没有在configuration.xml配置对应的sql配置文件
- 错误:Error updating database. Cause: java.lang.IllegalArgumentException:
- Mapped Statements collection does not contain value for Mapper. Cause:
- java.lang.IllegalArgumentException: Mapped Statements collection does not
- contain value for Mapper.
- 解决方法:
- 在configuration.xml配置文件中引用对应的sql配置文件
3 .org apache. ibatis. binding. BindingException: Type interface org . aptech. hdax . dao. BlonDao is not known to the MapperRegistry.
- 错误:绑定错误
- 原因:mybatis配置中或许没有导入配置文件
- 解决方案:去看看mybatis配置文件中mapper标签有没有导入映射文 件
4.Cause: com.microsoft.sqlserver.jdbc.SQLServerException: The index 2 is out of range.
- 错误:尝试为该参数设置不同的Jdbc类型,或者设置不同的配置属性;
似乎是因为两个分区类型不一样,而我查看认为一个参数,从而导致了错误。
5.javax.el.PropertyNotFoundException: Property ‘ID_CARD_NO’ not found on type com.amg.entity.Item
sql select 查询语句返回ID_CARD_NO字段,结果在com.amg.entity.Item类中找不到相应的属性