標籤:except font dstat 技術分享 apach get exe span 查詢語句
今天遇到一個問題,原來是mapper.xml檔案出了問題,是使用MyBatis最常見的一種錯誤
報錯的結果是這樣的:
A query was run and no Result Maps were found for the Mapped Statement ‘cn.zrgk.dao.RoleMapper.getRoleList‘.
It‘s likely that neither a Result Type nor a Result Map was specified.
org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement ‘cn.zrgk.dao.RoleMapper.getRoleList‘.
It‘s likely that neither a Result Type nor a Result Map was specified. org.apache.ibatis.executor.resultset.FastResultSetHandler.validateResultMapsCount(FastResultSetHandler.java:177) org.apache.ibatis.executor.resultset.FastResultSetHandler.handleResultSets(FastResultSetHandler.java:150) org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:57) org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:70) org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:57) org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:259) org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:132) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606)
我的mapper.xml檔案中有個查詢語句是這樣寫的:
大家看看圖一,好像根本沒有錯誤,對嗎?再看看
是的,沒錯,我沒有指定這個方法的傳回型別,系統無法識別,於是就這樣改了一下,發現不報錯了
所以平時啊,我們要多多注意這些細節,更要去多加理解
A query was run and no Result Maps were found for...原來是mapper.xml檔案出了問題,是使用MyBatis最常見的一種錯誤