--- 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)java
出現這個錯誤是因爲Worker對象已經有了帶參數的構造函數,卻沒有爲Worker對象寫一個空的構造函數。加上下面紅色部分就行了。或者把Worker全部的構造函數都刪除。spring
// ibatis須要一個不帶參數的構造函數
public Worker() {
}
public Worker(String name, String telephone) {
this.name = name;
this.telephone = telephone;
}
app