mybatis配置遇到的问题There is no getter for property named 'post_title' in 'class
来源:互联网 发布:linux samba配置用户 编辑:程序博客网 时间:2024/05/22 12:20
Exception in thread "main" org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'post_title' in 'class com.idolfans.entity.Post' at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:368) at com.sun.proxy.$Proxy8.insert(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:240) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:51) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52) at com.sun.proxy.$Proxy23.addPost(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy24.addPost(Unknown Source) at com.idolfans.test.Test.main(Test.java:37)
原因是因为sql语句写错了字段
insert into post(post_title,post_content,post_date,user_id,parent_id,idol_id) value(#{post_title},#{post_content},#{post_date}, #{user_id},#{parent_id},#{idol_id});
value()括号里面写的应该是类属性,而非数据库字段
insert into post(post_title,post_content,post_date,user_id,parent_id,idol_id) value(#{postTitle},#{postContent},#{postDate}, #{user.userId},#{parentId},#{idolId});
user是映射关系,用“应用变量.属性 ”的方式与表字段匹配
阅读全文
0 0
- mybatis配置遇到的问题There is no getter for property named 'post_title' in 'class
- mybatis "There is no getter for property named 'xx' in 'class java.lang.String"问题
- Mybatis问题:There is no getter for property named 'VALUE' in 'class java.lang.String'
- Mybatis问题-----There is no getter for property named 'productCode' in 'class java.lang.Strin g'
- Mybatis问题:There is no getter for property named 'Id' in 'class java.lang.String'
- 关于myBatis的问题There is no getter for property named 'USER_NAME' in 'class com.bky.model.实例类'
- Mybatis ReflectionException:There is no getter for property named 遇到的问题小结
- There is no getter for property named 'xxx' in 'class.....'
- mybatis There is no getter for property named 'xx' in 'class java.lang.String
- Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String'
- Mybatis-There is no getter for property named 'XXX' in 'class java.lang.String'解决办法
- Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String'
- mybatis:There is no getter for property named 'xxx' in 'class java.lang.String'
- Mybatis-There is no getter for property named 'id' in 'class java.lang.String'
- mybatis There is no getter for property named 'xx' in 'class java.lang.String
- Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String'
- Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String'
- MyBatis There is no getter for property named 'xxx' in 'class java.lang.String'
- 【条件渲染】关于在<template>上使用v-if分类的理解
- [leetcode] 第四周作业
- 公众平台接口 win7 的环境下HTTPS方式调用的配置
- log4j 多个日志文件
- __stdcall,__cdecl,__fastcall的区别
- mybatis配置遇到的问题There is no getter for property named 'post_title' in 'class
- Tomcat启动项目,报错The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xm
- 第7章-选择器+伪类
- 使用泛型来创建我们自己的列表
- Guitar Pro 7 中文破解版-汉化破解版地址
- 三 service 面试详解
- PHP中 XBM格式 文件的操作
- MySQL数据库索引
- 迅速教你掌握Web运维技能