mybatis错误一:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
解决方法:
把mybatis的Mapper.java 和 Mapper.xml 和Mapper.xml中得,namespace 保持一致,
简单的说: 把Mapper.java 和Mapper.xml放入到同一个包中,然后XML中得namespace=Mapper.java的全类名 就 OK了
mybatis 错误二:
is not known to the MapperRegistry
解决方法:
mapper.xml中得namespace配置错误,不是借口的全限定名(包名.类名)
mybatis错误三:
org.apache.ibatis.cache.CacheException: Error serializing object. Cause: java.io.NotSerializableException:
解决方法:
采用二级缓存的实体类要实现可序列化接口:implements Serializable
mybatis 错误四:
mybatis 使用二级缓存,但是如果前一个sqlSession不提交 .commit(); 那么就不能使用二级缓存。
解决方法:
未解决
mybatis 错误五:
Invalid bound statement (not found)
解决方法:
接口 .java
sql映射文件 .xml (与接口名保持一致,并且在同一包下)
sql文件的namespace属性值与接口的全限定名称一直
mybatis 错误六:
java实体类中是Boolean类型,数据库中是int类型,更新时不能使用
<if test="aa=!=null and aa!=''"> 只能使用<if test="aa!=null">
mybatis 错误七:
java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">
<constructor-arg ref="sqlSessionFactory" />
</bean>
<!--add scope="prototype" -->
来源:oschina
链接:https://my.oschina.net/u/1775885/blog/277424