在插入数据时报错:There is no getter for property named 'notice' in 'class com.game.domain.Notices'

四月 11, 2018 10:49:07 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [springmvc] in context with path [/SpringDemo] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'notice' in 'class com.game.domain.Notices'] with root cause
org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'notice' in 'class com.game.domain.Notices'
at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:419)
at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:164)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:162)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:49)
at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122)
at org.apache.ibatis.reflection.MetaObject.metaObjectForProperty(MetaObject.java:145)
at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:115)
at org.apache.ibatis.executor.BaseExecutor.createCacheKey(BaseExecutor.java:219)
at org.apache.ibatis.executor.CachingExecutor.createCacheKey(CachingExecutor.java:146)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:82)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

1. 数据库表

2. Notices.java

public class Notices implements Serializable{
private Integer noticeID;
private String noticeName;
private String noticeContent; //setter and getter }

3. SQL语句

public String insertNotice(final Notices notice){

            return new SQL(){
{
INSERT_INTO("notices");
if(notice.getNoticeName() != null && !notice.getNoticeName().equals("")){
VALUES("noticeName", "#{notice.noticeName}");//notice.noticeName改成noticeName
}
if(notice.getNoticeContent() != null && !notice.getNoticeContent().equals("")){
VALUES("noticeContent", "#{notice.noticeContent}");//notice.noticeContent改成noticeContent
}
}
}.toString();
}

原因:#{noticeContent}应该是取Notices的属性值,而不是取当前notice的属性值

There is no getter for property named 'notice' in 'class com.game.domain.Notices'的更多相关文章

  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. 基于Vue+Spring MVC+MyBatis+Shiro+Dubbo开发的分布式后台管理系统

    本文项目代码: 服务端:https://github.com/lining90567/dubbo-demo-server 前端:https://github.com/lining90567/dubbo ...

  2. redis中key的归类

    redis中可以使用前缀对key进行归类: 例如:key: ITEM_INFO:123456:BASE ITEM_INFO:123456:DESC 作用:方便进行管理 如果把二维表保存到redis中: ...

  3. 阿里云Linux的mysql安装,使用yum安装

    1.下载 我下载的mysql5.7 rpm格式的,在Linux的根目录下下载(防止出现安装的问题) wget https://dev.mysql.com/get/mysql57-community-r ...

  4. int str input的运用

  5. Haproxy介绍、安装与配置

    Haproxy技术详解一. 介绍HAProxy是一个使用C语言编写的自由及开放源代码软件,其提供高可用性.负载均衡,以及基于TCP和HTTP的应用程序代理.HAProxy特别适用于那些负载特大的web ...

  6. VS2017+CMake+OpenCV下报错 set OpenCV_FOUND to FALSE

    问题 在 VS 2017 中使用Cmake 管理项目, 使用 opencv 库, 在find package的时候出现能找到 OpenCVConfig.cmake的文件,但是设置 OpenCV_Fou ...

  7. 如何在window服务器上搭建一个能代替ftp的传输工具

    通常对于服务器上的文件管理和数据传输都是利用ftp来实现,但随着存储技术的发展,数据资产的存储规模和复杂程度不断提高,传统的ftp传输显得有笨重.今天给大家介绍一款能够取代ftp的在线文档管理软件—— ...

  8. Scrum立会报告+燃尽图(Final阶段第三次)

    此作业要求参见:https://edu.cnblogs.com/campus/nenu/2018fall/homework/2481 项目地址:https://coding.net/u/wuyy694 ...

  9. Thunder团队--Beta发布用户使用报告

    Thunder爱阅app Beta 发布用户使用报告 用户数量:14人 以下为用户评论:(注:为了保护用户的姓名权,以下用户名以昵称形式给出.) 序号 昵称 个人信息 获得软件途径 使用次数 用户评论 ...

  10. url传多值问题

    使用url传值的特点是操作简单,虽然安全性低,但依然广泛运用. url传数据绑定的值: <a href='Default.aspx?id=<%#Eval("ID")%& ...