org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause:
org.apache.ibatis.reflection.ReflectionException: There is no getter for
property named ’empid’ in ‘class cn.happy.entity.Emp’
### Cause: org.apache.ibatis.reflection.ReflectionException: There is
no getter for property named ’empid’ in ‘class cn.happy.entity.Emp’
at
org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
at
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:107)
at
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98)
at
cn.happy.test.Test5_MyBatisDynamic.test_getAllEmpInfo(Test5_MyBatisDynamic.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
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 ’empid’ in ‘class cn.happy.entity.Emp’
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.CachingExecutor.query(CachingExecutor.java:79)
at
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104)
… 26 more
此特别信息在开发之历程中为每每的可看得到,当然也是比较简单的十分。在非常的音信遭受比了解的指明了诱惑那个的故There
is no getter for property named ’empid’ in ‘class
cn.happy.entity.Emp’,找到呼应的MODEL看看有没起相应之性能和相应的SET和GET
方法!我此是紧缺相应的性质,也常有未曾相应之SET和GET方法!
只是用注意的是:在MyBatis映射文件中因故#跟$传递参数的风味,#凡是因占位符的形式来传递对应变量的参数值的,框架会指向传播的参数做预编译的动作,用$时会将盛传的变量的参数值原样的传递过去,并且因此$传递传递参数的时刻要出对应之GET方法,在MyBatis的照射文件被而因此有变量传递传递参数,这个变量必须有让对应的范中,并且发生照应的GET方法!此点时引起莫名的十分问题,要多加留心!
重要原因,其实是实体类的字段大小写及if语句里的字段大小写不一样!