<configuration> <settings> <!--当返回行的所有列都是空时,MyBatis默认返回null--> <setting name="returnInstanceForEmptyRow" value="true"/> </settings> <!-- 为JAVA Bean起类别名 --> <typeAliases > <!-- 别名方式1,一个一个的配置 type中放置的是类的全路径,alias中放置的是类别名 <typeAliase type="com.cy.mybatis.beans.UserBean" alias="UserBean"/> --> <!-- 别名方式2,自动扫描,将JAVA类的类名作为类的类别名 --> <package name="bean"/> </typeAliases>
log4j:WARN No appenders could be found for logger (org.apache.ibatis.logging.LogFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
org.apache.ibatis.exceptions.PersistenceException:
### Error building SqlSession.
### The error may exist in SQL Mapper Configuration
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: The setting returnInstanceForEmptyRow is not known. Make sure you spelled it correctly (case sensitive).
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:26)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:54)
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:38)
at tools.DBTools.<clinit>(DBTools.java:18)
at service.StudentService.selectStudentById(StudentService.java:17)
at service.StudentService.main(StudentService.java:11)
如果报Error parsing SQL错误的原因,我碰见的是在自己的Mybatis配置文件中多添加seting 配置,去除它,就可以解决问题。