There is no getter for property named 'notice' in 'class com.game.domain.Notices'
在插入数据时报错: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'的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- There is no getter for property named 'purchaseApplyId' in 'class java.lang.Long'
mapper.xml: <delete id="deleteByPurchaseAppyId" parameterType="Long"> < ...
- 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 ...
- 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 ...
- 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' ...
- 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 ...
- mybaits错误解决:There is no getter for property named 'parentId ' in class 'java.lang.String'
在使用mybaitis传参数的时候,如果仅传入一个类型为String的参数,那么在 xml文件中应该使用_parameter来代替参数名. 比如mapper中如下方法,只有一个String值 publ ...
随机推荐
- 菜鸟vimer成长记——第4.1章、通用插件
简介 关于插件的分类,此系列只会简单的区分为通用插件和编程插件.通用插件的意思是,不基于任何编程语言都可以使用的插件.编程插件,是针对于编程习惯,或者说是针对于某种语言的插件. 计划中,是先把基本常用 ...
- 稳重商务风格教师求职简历免费word模板
30款稳重商务风格教师求职简历免费word模板,也可用于其他专业和职业,个人免费简历模板,个人简历表免费,个人简历表格. 声明:该简历模板仅用于个人欣赏使用,请勿用于商业用途,谢谢. 下载地址:百度网 ...
- 保留mysql数据库中的最新1000条记录
<?php mysql_connect("localhost","root","root");mysql_select_db(&quo ...
- 如何把word ppt 思维导图这类文件转化为高清晰度的图片(要干货只看粗体黑字)
我使用思维导图做学习笔记,最终绘制了一张比较满意的思维导图,想要分享出去,但由于现在思维导图软件众多,成品文件格式差别蛮大,不利于传播和打开,所以需要转化为普通图片,但笔者使用的导图软件导出转化成的图 ...
- 分享一篇IBN(Intent-based networking)调研报告
IBN调研报告 背景 SDN(Software-defined network):最大特点在于具有松耦合的控制平面与数据平面.支持集中化的网络状态控制.实现底层网络设施对上层应用的透明.具有灵活的软件 ...
- MCS锁——可伸缩的自旋锁
在编写并发同步程序的时候,如果临界区非常小,比如说只有几条或几十条指令,那么我们可以选择自旋锁(spinlock).使用普通的互斥锁会涉及到操作系统的调度,因此小临界区一般首选自旋锁.自旋锁的工作方式 ...
- [linux] 利用PROMPT_COMMAND实现命令审计
网上查了实现命令审计大概有以下几种: 查不到了,改天再补充 以下环境基于CentOS 6 1.修改history时间格式 echo 'HISTTIMEFORMAT="%F %T " ...
- proxyTable中pathWrrite的使用
proxyTable中pathWrrite的使用 proxyTable: { '/iclient': { target: 'http://xxx.xx.com/iclient/xx/xx', chan ...
- Notes of Daily Scrum Meeting(11.5)
Notes of Daily Scrum Meeting(11.5) 今天是我们学习学长代码,同时学习安卓语言的第三天.我们和学长沟通了一下,仔细讨论后得出一个结论,学长在 IOS平台上的代码可以借鉴 ...
- 20135316王剑桥 linux第四周课实验笔记
第三章 程序的机器级表示 3.1历史观点 Intel处理器的换代:8086——80286——i386——i486——Pentium——PentiumPro——PentiumII——PentiumIII ...