今天在使用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. MySQL改密码

    必须先修改my.cnf 添加 skip-grant-tables   然后  执行  update mysql.user set authentication_string=password('123 ...

  2. index.html jquery

    index.html   <!DOCTYPE html> <html lang="en"> <head> <meta charset=&q ...

  3. PAT 1136 A Delayed Palindrome

    1136 A Delayed Palindrome (20 分)   Consider a positive integer N written in standard notation with k ...

  4. 生成器的认识及其思考:VAE, GAN, Flow-based Invertible Model

    生成器对应于认知器的逆过程. 这一切的起源都是当初一个极具启发性的思想:Sleep-wake algorithm——人睡眠时整理记忆做梦,是一个生成的过程,即通过最终的识别结果企图恢复接收到的刺激,当 ...

  5. 2015-10-26 c#2

    二.值类型和引用类型 2.1  值类型:所有的数值类型都是值类型(short int long float double ...),枚举,布尔类型,结构 2.2  引用类型:对象 ,字符串,objec ...

  6. Python之AJAX

    AJAX <script> $("#i4").on("click", function () { var i1 = $("#i1" ...

  7. 在递归函数中使用JQuery.Deferred,异步请求中的同步执行...

    标题不知道怎么起合适,其实需求很简单: 黑色背景的容器在页面打开时是隐藏的,点击提交后显示. 然后开始执行递归方法,每次ajax请求完成时,更新容器内容. 在全部执行完成后输出“执行完成”. subm ...

  8. java多线程高并发知识总结

    1.      计算机系统 使用高速缓存来作为内存与处理器之间的缓冲,将运算需要用到的数据复制到缓存中,让计算能快速进行:当运算结束后再从缓存同步回内存之中,这样处理器就无需等待缓慢的内存读写了. 缓 ...

  9. 版本管理工具小乌龟TortoiseGit的安装和使用(2)

    内容中包含 base64string 图片造成字符过多,拒绝显示

  10. 用VS2017编写C语言的Hello World

    1.新建项目 2.选择新建空项目 3.在源文件处右键单击,选择添加-新建项 4.选择“c++文件”,将名称后缀改成.c即可用C语言编写程序 5.编写代码: #include <stdio.h&g ...