The error occurred while applying a result map.
2016-04-05 22:24
716 查看
--- The error occurred in com/lgy/model/Worker.xml.
--- The error occurred while applying a result map.
--- Check the selectAllWorkers-AutoResultMap.
--- The error occured while instantiating the result object
--- Cause: java.lang.RuntimeException: JavaBeansDataExchange could not instantiate result class. Cause: java.lang.InstantiationException: com.lgy.model.Worker; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/lgy/model/Worker.xml.
--- The error occurred while applying a result map.
--- Check the selectAllWorkers-AutoResultMap.
--- The error occured while instantiating the result object
--- Cause: java.lang.RuntimeException: JavaBeansDataExchange could not instantiate result class. Cause: java.lang.InstantiationException: com.lgy.model.Worker
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84)
出现这个错误是由于Worker对象已经有了带参数的构造函数,却没有为Worker对象写一个空的构造函数。加上下面红色部分就好了。或者把Worker所有的构造函数都删除。
// ibatis需要一个不带参数的构造函数
public Worker() {
}
public Worker(String name, String telephone) {
this.name = name;
this.telephone = telephone;
}
--- The error occurred while applying a result map.
--- Check the selectAllWorkers-AutoResultMap.
--- The error occured while instantiating the result object
--- Cause: java.lang.RuntimeException: JavaBeansDataExchange could not instantiate result class. Cause: java.lang.InstantiationException: com.lgy.model.Worker; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/lgy/model/Worker.xml.
--- The error occurred while applying a result map.
--- Check the selectAllWorkers-AutoResultMap.
--- The error occured while instantiating the result object
--- Cause: java.lang.RuntimeException: JavaBeansDataExchange could not instantiate result class. Cause: java.lang.InstantiationException: com.lgy.model.Worker
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84)
出现这个错误是由于Worker对象已经有了带参数的构造函数,却没有为Worker对象写一个空的构造函数。加上下面红色部分就好了。或者把Worker所有的构造函数都删除。
// ibatis需要一个不带参数的构造函数
public Worker() {
}
public Worker(String name, String telephone) {
this.name = name;
this.telephone = telephone;
}
相关文章推荐
- ibatis简单实现与配置
- ibatis 的缓存
- ibatis 简单使用
- Mapped Statements collection does not contain
- 简单实现ibatis的物理分页
- ibatis加memcached缓存
- ibatis 高速缓存
- 最近在用ibatis,发些文章来学习下
- 学习ibatis,参照夏晰翻译的ibatis2.0学习指南
- 从IBatis2.X 移植到IBatis3.0 sqlMapConfig and sqlMap XML 配置文件升级说明
- iBATIS教程之快速入门浅析
- struts2.1.8+mybatis3.0+spring3.0(全注解)小例子
- iBatis2--SqlMap的配置总结
- ibatis 动态Sql
- Hibernate和ibatis在同一个webapp中混合使用在spring中的配置方法
- How to use custom type handler (typeHandler) in ibatis 2.3.4
- iBatis 配置文件详解
- ibatis中#和$用法区别
- ibatis 直接升格为 apache 一级项目了
- 做Web开发真累