There is no getter for property named 'purchaseApplyId' in 'class java.lang.Long'
mapper.xml:
<delete id="deleteByPurchaseAppyId" parameterType="Long"> <if test="purchaseApplyId != null"> delete from <include refid="t_purchaseApplyItem"/> where purchase_apply_id = #{purchaseApplyId} </if> </delete>
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'purchaseApplyId' in 'class java.lang.Long'
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:365)
at com.sun.proxy.$Proxy10.delete(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.delete(SqlSessionTemplate.java:265)
at com.banksteel.erp.purchase.dao.impl.PurchaseApplyDaoImpl.deleteByPurchaseAppyId(PurchaseApplyDaoImpl.java:23)
at com.banksteel.erp.purchase.PurchaseApplyServiceTest.testDeleteItem(PurchaseApplyServiceTest.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'purchaseApplyId' in 'class java.lang.Long'
at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:377)
at org.apache.ibatis.reflection.MetaClass.getGetInvoker(MetaClass.java:167)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty(BeanWrapper.java:149)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.get(BeanWrapper.java:45)
at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:113)
at org.apache.ibatis.scripting.xmltags.DynamicContext$ContextMap.get(DynamicContext.java:89)
at org.apache.ibatis.scripting.xmltags.DynamicContext$ContextAccessor.getProperty(DynamicContext.java:107)
at org.apache.ibatis.ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1657)
at org.apache.ibatis.ognl.ASTProperty.getValueBody(ASTProperty.java:92)
at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:210)
at org.apache.ibatis.ognl.ASTNotEq.getValueBody(ASTNotEq.java:49)
at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:210)
at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:333)
at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:413)
at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:395)
at org.apache.ibatis.scripting.xmltags.OgnlCache.getValue(OgnlCache.java:45)
at org.apache.ibatis.scripting.xmltags.ExpressionEvaluator.evaluateBoolean(ExpressionEvaluator.java:29)
at org.apache.ibatis.scripting.xmltags.IfSqlNode.apply(IfSqlNode.java:30)
at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:29)
at org.apache.ibatis.scripting.xmltags.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:37)
at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:265)
at org.apache.ibatis.executor.statement.BaseStatementHandler.<init>(BaseStatementHandler.java:61)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.<init>(PreparedStatementHandler.java:36)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.<init>(RoutingStatementHandler.java:42)
at org.apache.ibatis.session.Configuration.newStatementHandler(Configuration.java:448)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:43)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:100)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:148)
at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:161)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:355)
... 32 more
解决:
因为写了,导致错误,
<if test="purchaseApplyId != null">
修改成一下mapper就可以了,具体因为啥,我也不知道。。。大神可以指导下!
正确的mapper写法:
<delete id="deleteByPurchaseAppyId" parameterType="Long"> delete from <include refid="t_purchaseApplyItem"/> where purchase_apply_id = #{purchaseApplyId} </delete>
一切就ok了
相关文章
- Java笔记:多线程
- 微信支付(公众号支付APIJS、app支付)服务端统一下单接口java版
- [Java基础] java多线程关于消费者和生产者
- SSM框架报错分析(一)——There is no getter for property named 'XXX' in 'class java.lang.String'
- JAVA-JSP内置对象之request范围
- JAVA学习(五):Java面向对象编程基础
- Java实现 洛谷 P6183 [USACO10MAR]The Rock Game S(DFS)
- Java实现洛谷 P1062 数列
- Java实现 LeetCode 416 分割等和子集
- Java中数组二分法查找
- Java基础之深入理解Class对象与反射机制
- 【JAVA】 04-Java中的多线程
- 【JAVA】java编译错误:编码UTF8/GBK的不可映射字符
- 有关C,C++,C#, Java的图形图像处理类库 整理(未完待续)
- Java java.util.concurrent.Future的一个例子
- Spire.Office for Java 8.2.0 强大之喜Xaspose
- Spire.Presentation[PPT/PPTX] 8.1.2 for Java Crack
- Spire.Doc for Java 10.12.4 || Spire.Presentation 7.12.1
- Spire.Office for Java 7.6.4
- Error:Execution failed for task ‘:app:transformNative_libsWithStripDebugSymbolForDebug‘.> java.io.IO
- java.sql.SQLException: Access denied for user ‘root‘@‘localhost‘ (using password: YES)
- 【java】Java教程
- 【Java编程】之 List 与数组之间的相互转换&Arrays.asList 和 ArrayList 的 subList
- java读取xml文件
- Java设计模式偷跑系列(十八)建模和责任链模式的实现
- java.lang.OutOfMemoryError: Java heap space错误及处理办法(收集整理、转)
- java.net.ConnectException: Call From slaver1/192.168.19.128 to slaver1:8020 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org
- 循环遍历Java字符串字符的规范方法——类似python for ch in string
- 下载各个版本java (Java Development Kit)
- Dynamsoft Barcode Reader For Java[WIN]
- Java 循环结构 - for, while 及 do…while
- 飞机大战Java版完整版