今天在使用mybatis时,出现了一个问题:There is no getter for property named 'user' in 'class com.jyr.wh.domain.User,现记录下来

使用注解的形式写sql语名,参数为一个对象

以下为正确写法:

@Insert(
"INSERT INTO t_user(openId,nickName,gender,language,city,province,country," +
"avatarUrl,unionId,appid,timestamp) " +
"VALUES(#{openId},#{nickName},#{gender},#{language},#{city},#{province},#{country}," +
"#{avatarUrl},#{unionId},#{watermark.appid},#{watermark.timestamp})"
)
int insert(User user);
import java.io.Serializable;

public class User implements Serializable {

    private String openId;
private String nickName;
private String gender;
private String language;
private String city;
private String province;
private String country;
private String avatarUrl;//头像
private String unionId;
private WaterMark watermark; public class WaterMark{
private String appid;
private String timestamp;
}
}
} 以上省略get、set方法

报错找不到user那是因为我的sql写错了,在values的参数中加了形参

@Insert(
"INSERT INTO t_user(openId,nickName,gender,language,city,province,country," +
"avatarUrl,unionId,appid,timestamp) " +
"VALUES(#{user.openId},#{user.nickName},#{user.gender},#{user.language},#{user.city},#{user.province},#{user.country}," +
"#{user.avatarUrl},#{user.unionId},#{user.watermark.appid},#{user.watermark.timestamp})"
)
int insert(User user);

在使用注解方式时形参不用写,只写传的对象的属性即可,加上会报以上错误。

~~~~~~~~~~ 完 ~~~~~~~~~~~~

There is no getter for property named 'user' in 'class com.jyr.wh.domain.User' 异常的更多相关文章

  1. There is no getter for property named 'useName' in 'class cn.itcast.mybatis.pojo.User'

    org.apache.ibatis.exceptions.PersistenceException: ### Error updating database.  Cause: org.apache.i ...

  2. mybatis There is no getter for property named 'xxxx

    mybatis There is no getter for property named 'xxxx 360反馈意见截图16230322799670.png http://blog.sina.com ...

  3. MyBatis查询传一个参数时报错:There is no getter for property named 'sleevetype' in 'class java.lang.Integer

    用MyBatis进行查询,传入参数只有一个时(非Map)如int,报错 There is no getter for property named 'sleevetype' in 'class jav ...

  4. There is no getter for property named 'purchaseApplyId' in 'class java.lang.Long'

    mapper.xml: <delete id="deleteByPurchaseAppyId" parameterType="Long"> < ...

  5. MyBatis3: There is no getter for property named 'code' in 'class java.lang.String'

    mybatis3  : mysql文如下,传入参数为string类型时‘preCode’,运行报错为:There is no getter for property named 'preCode' i ...

  6. mybatis There is no getter for property named 'xx' in 'class java.lang.String

    转载自://http://www.cnblogs.com/anee/p/3324140.html 用mybatis查询时,传入一个字符串传参数,且进行判断时,会报 There is no getter ...

  7. There is no getter for property named 'userSpAndSp' in 'class com.uauth.beans.UserSpAndSp'

    mybatis 报错There is no getter for property named 'userSpAndSp' in 'class com.uauth.beans.UserSpAndSp' ...

  8. There is no getter for property named 'userId' in 'class java.lang.String'

    [ERROR] 2017-01-18 04:37:06:231 cn.dataenergy.common.CenterHandlerExceptionResolver (CenterHandlerEx ...

  9. mybaits错误解决:There is no getter for property named 'parentId ' in class 'java.lang.String'

    在使用mybaitis传参数的时候,如果仅传入一个类型为String的参数,那么在 xml文件中应该使用_parameter来代替参数名. 比如mapper中如下方法,只有一个String值 publ ...

随机推荐

  1. go学习笔记-简述

    1.程序结构 Go程序结构和C系程序(C/C++/JAVA等)一致,基本语句被组织成函数用于隔离和复用,函数组成源文件和包.Go程序存储在一个或多个.go文件中,每个文件都已pakage开头,表面当前 ...

  2. JRebel springboot部署idea

    JRebel springboot部署idea     http://127.0.0.1:8888/88414687-3b91-4286-89ba-2dc813b107ce   ctrl+shift+ ...

  3. Spring中使用RedisTemplate操作Redis(spring-data-redis)

    RedisTemplate如何检查一个key是否存在? return getRedisTemplate().hasKey(key); 由一个问题,复习了一下redis 抄自: https://www. ...

  4. Mac搭建SVN服务器+Cornerstone连接服务器

    Mac自带svn,我们只需配置并开启就可以了,打开终端,输入svnserve --version查看svn版本 可以看到我的mac自带的svn版本号为1.9.7,下面开始配置服务器: 1.终端输入su ...

  5. multiprocessing

    multiprocessing multiprocessing模块是跨平台版本的多进程模块. multiprocessing模块提供了一个Process类来代表一个进程对象. multiprocess ...

  6. csla框架__使用Factory方式实现Csla.BusinessBase对象数据处理

    环境:.net4.6+csla4.6 实现:对象的数据库访问及数据库执行使用Factory方式进行封闭. 正文: 以前在使用csla框架完成业务对象的定义时所有的数据处理都在对象内部实现,也不能说不好 ...

  7. 201671010142 2017-2 《java第九章学习感悟》

    一,数组(可以存储基本数据类型)是用来存现对象的一种容器,但是数组的长度固定,不适合在对象数量未知的情况下使用. 集合(只能存储对象,对象类型可以不一样)的长度可变,可在多数情况下使用. 二.几种重要 ...

  8. centos7 无界面静默安装 oracle

    环境准备 Centos7.3.64  64位   这里使用的是阿里云 ECS主机(1核,2G内存,40G硬盘) Oracle 11g R2 64位安装介质(版本11.2.0.1)下载地址:http:/ ...

  9. 关于基于LinphoneSDK通话项目开发中遇到的相关问题

    在之前小学期的项目开发当中,我们小组进行的是使用网上开源的LinphoneSDK来开发一款Android端的VOIP电话APP. 因为网上关于这个SDK在安卓端的开发文档相当少,所以我们只能根据少量的 ...

  10. react系列笔记:第二记-中间件

    中间件所做的事情就是在action发起后,到reducer之前做扩展,实现的方式是对store的dispatch进行包装 store.dispatch => [middlewales] => ...