为了账号安全,请及时绑定邮箱和手机立即绑定

Lambda构造器查询报错

Lambda构造器查询,更新等操作报错(只要是Lambda构造器就不行),版本3.1.2;工具:eclipse sts;

换版本也不行,工具原因????
报错如下:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression 'ew.sqlSegment != null and ew.sqlSegment != '' and ew.nonEmptyOfWhere'. Cause: org.apache.ibatis.ognl.OgnlException: sqlSegment [org.apache.ibatis.reflection.ReflectionException: Error parsing property name 'lambda$3'.  Didn't start with 'is', 'get' or 'set'.]

at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)

at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)

at com.sun.proxy.$Proxy35.selectList(Unknown Source)

at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)

at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForMany(MybatisMapperMethod.java:158)

at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:76)

at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:62)

at com.sun.proxy.$Proxy36.selectList(Unknown Source)

at MybatisPlusTest.getByWrapper12(MybatisPlusTest.java:275)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)

at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)

at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)

at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)

at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)

at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)

at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)

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:459)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Caused by: org.apache.ibatis.builder.BuilderException: Error evaluating expression 'ew.sqlSegment != null and ew.sqlSegment != '' and ew.nonEmptyOfWhere'. Cause: org.apache.ibatis.ognl.OgnlException: sqlSegment [org.apache.ibatis.reflection.ReflectionException: Error parsing property name 'lambda$3'.  Didn't start with 'is', 'get' or 'set'.]

at org.apache.ibatis.scripting.xmltags.OgnlCache.getValue(OgnlCache.java:48)

at org.apache.ibatis.scripting.xmltags.ExpressionEvaluator.evaluateBoolean(ExpressionEvaluator.java:32)

at org.apache.ibatis.scripting.xmltags.IfSqlNode.apply(IfSqlNode.java:34)

at org.apache.ibatis.scripting.xmltags.MixedSqlNode.lambda$apply$0(MixedSqlNode.java:32)

at java.util.ArrayList.forEach(ArrayList.java:1249)

at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:32)

at org.apache.ibatis.scripting.xmltags.TrimSqlNode.apply(TrimSqlNode.java:55)

at org.apache.ibatis.scripting.xmltags.MixedSqlNode.lambda$apply$0(MixedSqlNode.java:32)

at java.util.ArrayList.forEach(ArrayList.java:1249)

at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:32)

at org.apache.ibatis.scripting.xmltags.IfSqlNode.apply(IfSqlNode.java:35)

at org.apache.ibatis.scripting.xmltags.MixedSqlNode.lambda$apply$0(MixedSqlNode.java:32)

at java.util.ArrayList.forEach(ArrayList.java:1249)

at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:32)

at org.apache.ibatis.scripting.xmltags.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:39)

at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:297)

at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81)

at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)

at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)

... 38 more

Caused by: org.apache.ibatis.ognl.OgnlException: sqlSegment [org.apache.ibatis.reflection.ReflectionException: Error parsing property name 'lambda$3'.  Didn't start with 'is', 'get' or 'set'.]

at org.apache.ibatis.ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:1693)

at org.apache.ibatis.ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:60)

at org.apache.ibatis.ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:147)

at org.apache.ibatis.ognl.OgnlRuntime.getProperty(OgnlRuntime.java:2719)

at org.apache.ibatis.ognl.ASTProperty.getValueBody(ASTProperty.java:114)

at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)

at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:258)

at org.apache.ibatis.ognl.ASTChain.getValueBody(ASTChain.java:141)

at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)

at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:258)

at org.apache.ibatis.ognl.ASTNotEq.getValueBody(ASTNotEq.java:50)

at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)

at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:258)

at org.apache.ibatis.ognl.ASTAnd.getValueBody(ASTAnd.java:61)

at org.apache.ibatis.ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)

at org.apache.ibatis.ognl.SimpleNode.getValue(SimpleNode.java:258)

at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:493)

at org.apache.ibatis.ognl.Ognl.getValue(Ognl.java:457)

at org.apache.ibatis.scripting.xmltags.OgnlCache.getValue(OgnlCache.java:46)

... 61 more

Caused by: org.apache.ibatis.reflection.ReflectionException: Error parsing property name 'lambda$3'.  Didn't start with 'is', 'get' or 'set'.

at org.apache.ibatis.reflection.property.PropertyNamer.methodToProperty(PropertyNamer.java:37)

at com.baomidou.mybatisplus.core.conditions.AbstractLambdaWrapper.getColumn(AbstractLambdaWrapper.java:88)

at com.baomidou.mybatisplus.core.conditions.AbstractLambdaWrapper.columnToString(AbstractLambdaWrapper.java:72)

at com.baomidou.mybatisplus.core.conditions.AbstractLambdaWrapper.columnToString(AbstractLambdaWrapper.java:68)

at com.baomidou.mybatisplus.core.conditions.AbstractLambdaWrapper.columnToString(AbstractLambdaWrapper.java:39)

at com.baomidou.mybatisplus.core.conditions.AbstractWrapper.lambda$likeValue$17384082$1(AbstractWrapper.java:320)

at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)

at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)

at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)

at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)

at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)

at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)

at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)

at com.baomidou.mybatisplus.core.conditions.segments.NormalSegmentList.childrenSqlSegment(NormalSegmentList.java:89)

at com.baomidou.mybatisplus.core.conditions.segments.AbstractISegmentList.getSqlSegment(AbstractISegmentList.java:96)

at com.baomidou.mybatisplus.core.conditions.segments.MergeSegments.getSqlSegment(MergeSegments.java:72)

at com.baomidou.mybatisplus.core.conditions.AbstractWrapper.getSqlSegment(AbstractWrapper.java:430)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.apache.ibatis.ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:881)

at org.apache.ibatis.ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:1691)

... 79 more


正在回答

4 回答

你lambda条件构造去那块是怎么写的,贴出来我看看呗,光看报错信息我分析不出来原因。还有你的sts安装lombok插件了吗?

0 回复 有任何疑惑可以回复我~
#1

qq_小庄_1 提问者

插件是安装了的,点开User类编辑器里面能显示出get,set,toString等自动编译生成的方法。 测试代码:很简单1:创建lambdad的wrapper; 2: wrapper添加过滤条件 3:执行selectList操作 其中userMapper自定义的继承自BaseMapper
2019-07-19 回复 有任何疑惑可以回复我~

真是工具原因啊啊啊啊啊啊啊啊,下面是我把工程切换到 idea2017 下面的结果:

https://img1.sycdn.imooc.com//5d31842c0001c73610590780.jpg

2:就算user里面money是double,我Lambda过滤写错了,写成String类型依然能查出来(应该是自动转型了,反正都是数字,转成功了)
https://img1.sycdn.imooc.com//5d3184bc000127c012710791.jpg

0 回复 有任何疑惑可以回复我~
#1

老猿

哦,那看来数据类型那不是导致错误的原因。
2019-07-19 回复 有任何疑惑可以回复我~
#2

老猿

没帮上你什么忙。
2019-07-19 回复 有任何疑惑可以回复我~
#3

qq_小庄_1 提问者 回复 老猿

哪里哪里,本身这个课程就是帮助我们学习的!!!对于sts这个工具的原因我再去网上搜搜原因了
2019-07-19 回复 有任何疑惑可以回复我~
#4

老猿 回复 qq_小庄_1 提问者

呵呵,相互学习,共同进步!
2019-07-21 回复 有任何疑惑可以回复我~
查看1条回复

https://img1.sycdn.imooc.com//5d317af600014da812340180.jpg

第一行就是错误原因(百度翻译哈哈哈哈):感觉就是Lambda的过滤条件没解析出来导致ew.sqlsegment是空的,

分析属性名“lambda$3”时出错。不是以“is”、“get”或“set”开头的???????

0 回复 有任何疑惑可以回复我~
#1

老猿

如果方便的话,你把项目和数据库脚本传到百度网盘或者gitee,然后给我链接。我这给你调试一下。
2019-07-19 回复 有任何疑惑可以回复我~
#2

老猿

你的money属性是Double类型,但是条件构造器中是String类型的值,你用Double类型的值试试呢?
2019-07-19 回复 有任何疑惑可以回复我~
#3

qq_小庄_1 提问者 回复 老猿

老师,我把项目换到idea下就成功了,类型因为都是数字自动转型成功了没报错。真是工具原因,简直无语,这种bug累啊。。。。。。
2019-07-19 回复 有任何疑惑可以回复我~
#4

老猿 回复 qq_小庄_1 提问者

哦,成功了就好,但是正常的话eclipse应该也好使,可能还是哪设置的有问题。
2019-07-19 回复 有任何疑惑可以回复我~
查看1条回复

下面是测试代码:

https://img1.sycdn.imooc.com//5d3174a50001b9ad09530319.jpg

插件是安装了的,看user就知道:
https://img1.sycdn.imooc.com//5d31755e0001946e09390463.jpg

0 回复 有任何疑惑可以回复我~
#1

老猿

你的money熟悉是Double类型,但是条件构造器中是String类型的值,你用Double类型的值试试呢?
2019-07-19 回复 有任何疑惑可以回复我~
#2

老猿

money属性
2019-07-19 回复 有任何疑惑可以回复我~
#3

qq_小庄_1 提问者 回复 老猿

还是不行,我把money条件去掉都不行,一样的错误
2019-07-19 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

Lambda构造器查询报错

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信