Home > Database > Mysql Tutorial > mybatis查询是传参报错的处理_MySQL

mybatis查询是传参报错的处理_MySQL

WBOY
Release: 2016-06-01 13:35:55
Original
1165 people have browsed it

bitsCN.com

mybatis查询是传参报错的处理

 

自己用的数据库是mysql数据库,用mybatis管理,java后台是 spring框架,

控制台出现:

 

1

There is no getter for property named 'xxxx' in 'class java.lang.Integer

错误,查了一下,以为是xml中的sql的参数类型有错误,后来改了,不是,网上说改:

 

        SELECT

           id,name,login_name as loginName

        FROM

           sb_user

        where

        name like '%${_parameter}%'

   

我把原来的name的参数改成了_parameter就可以了,另一种方法是在mapper定义的接口中改:

由  List selectAllUserByName(String name);改成

 

 List selectAllUserByName(@Param("name")String name);

 

也可以解决问题。

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template