1. 程式人生 > >mybatis查詢符合條件的記錄數時錯誤there is no getter for property named。。。

mybatis查詢符合條件的記錄數時錯誤there is no getter for property named。。。

做分頁查詢時,查詢符合條件的總記錄數報錯:

    java.lang.RuntimeException: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'nameText' in 'class java.lang.String'
    org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'nameText' in 'class java.lang.String'
at 

mapper.xml的寫法為:

    <select id="getUserCount" resultMap="ResultMapWithBLOBs">
    select count(*) 
    from user 
    <if test="nameText != null">
        where name like CONCAT(CONCAT('%', #{nameText}), '%')
    </if>
  </select>

原因:介面中返回值為int,所以這裡的resultMap不可以是實體類,而應該是Integer,修改為:

<select id="getUserCount" parameterType="string" resultType="int">
    select count(*) 
    from user 
    <if test="nameText != null">
        where name like CONCAT(CONCAT('%', #{nameText}), '%')
    </if>
  </select>
int getUserCount(@Param("nameText") String nameText);

相關推薦

mybatis查詢符合條件記錄錯誤there is no getter for property named

做分頁查詢時,查詢符合條件的總記錄數報錯: java.lang.RuntimeException: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ib

mybatis中報There is no getter for property named 'devName' in 'class java.lang.String‘的錯誤

今天在做一個新專案的時候,寫好了controller,service,dao層後,在xml檔案中寫sql,因為這個介面要使用名稱來模糊查詢,但是執行的時候傳入引數,卻報There is no getter for property named 'devName' in 'class java.l

mybatis 基本型別的if條件判斷問題 There is no getter for property named 'xxx' in 'class Java.lang.Integer'

mybatis中if test裡判斷傳參時,如果傳參是像int的基本型別,因為它沒有getter方法所以會報錯:There is no getter for property named 'xxx' in 'class java.lang.Integer'  1.修改

mybatis 異常 There is no getter for property named 'bizId' in 'class java.lang.Long'

img 技術分享 .com mybatis lan alt nbsp pro 錯誤 mybatis 異常 There is no getter for property named ‘bizId‘ in ‘class java.lang.Long‘ 當使用mybatis進行

Mybatis 報錯 There is no getter for property named '***' in 'class java.lang.String'

sql 使用 mybatis and 參數 when choose orcal get 在mapper.xml中 , 如果單參數是String類型 , 且在sql語句中對參數進行了判斷 , 如下 when 中的判斷 , 如果出現 if 判斷也是一樣的。都需要把判斷中的參

Mybatis異常There is no getter for property named 'XXX' in 'class java.lang.String'

for ava 異常 public rom title mpc mybatis string Mybatis版本:mybatis-3.0.6.jar 1.當入參為 string類型時 (包括java.lang.String.) 我們使用#{xxx}引入參數.會拋異

mybatis之org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'time' in 'class java.lang.String'

mybatis 圖片 配置 style pac prop bubuko type PE mybatis接口 List<String> getUsedCate(String time); 配置文件 <select id="getUsed

Mybatis中傳參包There is no getter for property named 'XXX' in 'class java.lang.String'

col mybatis hone mybatis查詢 默認 lec named ongl bsp Mybatis中傳參包There is no getter for property named ‘XXX‘ in ‘class java.lang.String‘ 一、發現

mybatis 報錯There is no getter for property named 'XXX' in 'class com.xx.xx'

mybatis報錯資訊記錄: ### Error querying database.  Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'ba

mybaits錯誤解決:There is no getter for property named 'id' in class 'java.lang.String'

在使用mybaitis傳引數的時候,如果僅傳入一個型別為String的引數,那麼在 xml檔案中應該使用_parameter來代替引數名。 正確的寫法: <span style="font-size:18px;"> <!-- 用於查詢運單

Mybatis異常There is no getter for property named 'XXX' in 'class java.lang.String'

1.當入參為 string型別時 (包括java.lang.String.) 我們使用#{xxx}引入引數.會拋異常There is no getter for property named ‘XXX’ in ‘class java.lang.String’

解決mybatis報錯 There is no getter for property named ... in 'class java.lang.String'

發生這個的原因就是對於的屬性欄位沒有書寫正確,導致報錯。 這型別的報錯類似There is no getter for property named ... in 'classXXX。一個主要原因是在xml中進行引數配置的時候,引數名稱書寫錯誤。這個也是我遇到的問題。 為

springboot整合mybatis——報錯There is no getter for property named '*' in 'class java.lang.String

There is no getter for property named '*' in 'class java.lang.String',此錯誤之

關於myBatis的問題There is no getter for property named 'USER_NAME' in 'class com.bky.model.例項類'

現在流行的 ssm(spring + struts2 + myBatis)  持久層的mybatis是需要配置對映器的,找了個demo連線的資料庫是mysql 於是就修改了一下弄成了連線oracle的 一切就緒之後跑起來 執行插入操作的時候問題來了 ,報了一個這個錯我的表是

MyBatis報錯:There is no getter for property named 'xxx' in 'class java.lang.String'

在Mybatis的mapper檔案如果傳入的是一個字串型別的引數,且將該引數用來在<if test='"">判斷時,如果直接用引數名來判斷,則會報如標題所示的錯誤, 正確程式碼如下: &l

mybatis框架ReflectionException: There is no getter for property named 'XXX'解決

         今天執行新增方法時,遇到了如標題所示的錯誤,去網上大致搜了一圈,並不是一樣的情況,在確定實體類裡有get方法,及拼寫無錯誤後,當我把欄位xxx_xx下劃線都給實體類屬性保持一致後,可以運行了.          但是,接著我發現我已經在mybatis的配置

工單系列2 ---- MyBatis 報錯 there is no getter for property named “xxx” in "class xxx"

系統中資料由移植而來,所以某一張表,稱為A表吧,欄位好幾十個,都是按移出方提供的檔案來設定的,後來開發開發著,需求就多了起來,也需要在A表上新增幾個欄位。 但是我們開發也比較懶,做移植的指令碼寫的全部import到表裡,比如 import from [filename] o

mybatis加Spring專案: 解決There is no getter for property named '***' in 'class java.lang.String'問題

使用mybatis對映mysql資料庫時,傳入引數為'status',執行報錯為:There is no getter for property named 'status' in 'class java.lang.String 使用'#'作為mybatis的對映標識執行可

MyBatis學習06】_parameter:解決There is no getter for property named in class java.lang.String

我們知道在mybatis的對映中傳引數,只能傳入一個。通過#{引數名} 即可獲取傳入的值。 Mapper介面檔案: public int delete(int id) throws Exception; MapperL配置檔案: <dele

mybatis動態表名遇見There is no getter for property named 'tableName' in 'class java.lang.String'

(1)首先mybatis實現動態表名的sql語句 <select id="getData" resultType="java.util.HashMap" parameterType="Str