1. 程式人生 > >mybatis中報錯:resultType還是resultMap

mybatis中報錯:resultType還是resultMap

mybatis中報錯:

6-Jan-2018 12:08:04.280 SEVERE [http-nio-8080-exec-7] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [springMVC] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.builder.IncompleteElementException:Could not find result map com.ssm.blog.dao.BlogDAO.int

] with root cause
 java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.ssm.blog.dao.BlogDAO.int

很低階的錯誤,異常說沒有int這個result map

  1. <selectid="getCount"resultMap="int">
  2.    select count(*) from BOOK  
  3. </select>

count返回值是個int型的,沒有用結果集,所以應該是resultType而不是resultMap

  1. <selectid="getCount"resultType="int">
  2.    select count(*) from BOOK  
  3. </select>

相關推薦

mybatis中報resultType還是resultMap

mybatis中報錯: 6-Jan-2018 12:08:04.280 SEVERE [http-nio-8080-exec-7] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service(

Mybatis總結一resultTyperesultMap

一 resultType 如果返回的只是物件,而不是物件的list <sql id = "Base_Column"> p.id, p.name, p.age, p.gender , </sql> <select i

pycharm中報ImportError: No module named 'skimage'

提示 div uil ++ inf als 直接 技術 tools pycharm中直接setting是沒辦法成功的,會提示is requied C++ bool.....先進入那個頁面安裝好需要的tools,這個安裝比較慢:http://landinghub.visual

使用mybatisError setting non null for parameter #4 with JdbcType TIMESTAMP

一次性報的異常主要有以下幾個: java.lang.RuntimeException: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException

mybatisparameter ' ' not fount.Available parameters are [0, 1, param1, param2]

mybatis報錯:parameter ’ ’ not fount.Available parameters are [0, 1, param1, param2] 這種原因就是因為引數沒有對應上。解決方法就是在dao層方法引數加上@param(value=’’"),或者在sql語句中按照順序

Springboot中mybatisInvalid bound statement (not found)

小場面不要驚慌,分5種情況,檢查你的配置和程式碼,看有沒有中招; xml檔案的select標籤的id對應dao檔案的方法名,兩者必須完全一致 xml檔案中的 namespace=“xxx.xxx.xxx.Mapper” 中的路徑是否與介面檔案路徑一致 xml檔案中的p

python中報json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes

請求服務,服務一直報錯,寫了個demo import json str = "{'a':'b'}" print(json.loads(str)) 問題在json裡只能用雙引號,不能用單引號! import json str = '{"a":"b"}' print(json.load

Mybatisorg.apache.ibatis.exceptions.PersistenceException:

mybatis框架,在進行測試類測試時候一直報錯,如下: org.apache.ibatis.exceptions.PersistenceException: Error querying database. Cause: org.apache.ibatis.

springboot整合mybatisInvalid default: public abstract java.lang.Class org.mybatis.spring.annotation

在spring boot啟動main方法所在的類中加入 @MapperScan注入後報錯: Invalid default: public abstract java.lang.Class org.mybatis.spring.annotation.MapperScan.

部署struts2專案到Tomcat伺服器中報Dispatcher initialization failed 以及 Tomcat 始終載入同一個專案的web.xml配置檔案資訊

嚴重: Dispatcher initialization failed Unable to load configuration. - action - file:/E:/apache-tomcat-7.0.85/webapps/StrutsDemo/WEB-INF/classes/struts

mybatis輸出對映(resultType 和 resultMap

輸出對映 mybatis中的輸出對映有兩個:resultType 和 resultMap。依據不同情況,選擇不同的輸出對映。 resultType 使用resultType進行輸出對映,只有查詢出來的列名和pojo中的屬性名一致,該列才可以對映成功。 如果查詢出來

unittest中報AttributeError: 'TestLogin' object has no attribute 'driver'解決方法

object login 技術分享 17. ive drive attr info unit 源代碼如下: 更改後: 執行成功。unittest中報錯:AttributeError: 'TestLogin' object has no attribut

mybatisjava.sql.SQLException: 無效的列型別: 1111

 java.sql.SQLException: 無效的列型別: 1111  at oracle.jdbc.driver.OracleStatement.getInternalType(OracleStatement.java:3900)  at oracle.jdbc.

mybatisjava.lang.IllegalArgumentException: invalid comparison: java.util.Arrays$ArrayList and java.lang.String

一開始,我的寫法是在java中給這個變數賦值時,直接分割,引號包起來,然後再mybatis中的這個SQL中直接用${}引用,效果是能達到,後被告知這樣會有被攻擊的可能。便改成:賦值前轉成list,然後再mybatis中遍歷。 遍歷: 一開始裡面沒用 ,jdbcType=VARCHAR ,報錯..

mybatisthis is incompatible with sql_mode=only_full_group_by

在本地啟動專案後,發現控制檯報如下錯誤bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #3 of SELECT list is not i

Feign請求中報Request header is too large 的解決方案。

現在我們專案中都已遷入spring boot和spring cloud。 服務間呼叫現在都改成feign的呼叫方式,但是上次在實際使用過程中出現過:Request header is too large 的情況。 這裡重現下場景: 1,呼叫其他服務提供方的介面 2,POST請求,傳遞的引數包含資料較大 3,本

程式中報 MySQL server has gone away 是什麼意思? 如何避免?

Barracuda.130101 22:22:30 InnoDB: 1.1.8 started; log sequence number 63444325509130101 22:22:30 [Note] Server hostname (bind-address): '12

mybatisCause: java.sql.SQLException: Operand should contain 1 column(s)\n;

mybatis配置: <select id="queryDubboConfig" parameterType="map" resultMap="DubboConfigDO">

專案中報Warning: count():Parameter must be an array or an object that implements Countable的解決方案

報錯資訊:Warning: count(): Parameter must be an array or an object that implements Countable 這主要是7.2版本更新,部分方法變得更加嚴謹了 當傳遞一個無效引數的時候,count()函式會丟擲warning的警告

Mybatis無效的列型別

如果在xml中需要接收引數型別為Map型別,當你在sql語句中呼叫map中的引數時,可能會由於型別不一致原因造成錯誤,比如說 select count(1) from table1 where  name = #{name} 在Map中,name鍵對應的值是Object型