MyBatis problems encountered:
Org.mybatis.spring.MyBatisSystemException:nested exception is org.apache.ibatis.reflection.ReflectionException:there is no getter for property named ' Unitid ' in ' Class Java.lang.String ' At Org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible (Mybatisexceptiontranslator.java : () at Org.mybatis.spring.sqlsessiontemplate$sqlsessioninterceptor.invoke (sqlsessiontemplate.java:371) at Com.sun . Proxy. $Proxy 6.selectList (Unknown Source) at Org.mybatis.spring.SqlSessionTemplate.selectList ( sqlsessiontemplate.java:198) at Org.apache.ibatis.binding.MapperMethod.executeForMany (mappermethod.java:119) at Org.apache.ibatis.binding.MapperMethod.execute (mappermethod.java:63) at Org.apache.ibatis.binding.MapperProxy.invoke (mapperproxy.java:52) at Com.sun.proxy. $Proxy 11.getUsersByUnitId ( Unknown Source) at Com.thinkPro.steap.db.base.sys.user.UserBase.getUsersByUnitId (userbase.java:125) at Com.thinkpro . Steap.db.service.sys.user.UserService.getUsersByUnitId (userservice.java:188) at Com.thinkPro.steap.test.TestUser.testGetUsersByUnitId (testuser.java:184) 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: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.junit.runners.ParentRunner.runLeaf (parentrunner.java:325) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:78) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:57) 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.junit.runners.ParentRunner.run ( parentrunner.java:363) 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 getterFor property named ' Unitid ' in ' Class Java.lang.String ' At Org.apache.ibatis.reflection.Reflector.getGetInvoker (reflector.java:380) at Org.apache.ibatis.reflection.MetaClass.getGetInvoker (metaclass.java:170) at Org.apache.ibatis.reflection.wrapper.BeanWrapper.getBeanProperty (beanwrapper.java:152) at Org.apache.ibatis.reflection.wrapper.BeanWrapper.get (beanwrapper.java:48) at Org.apache.ibatis.reflection.MetaObject.getValue (metaobject.java:116) at Org.apache.ibatis.scripting.xmltags.dynamiccontext$contextmap.get (dynamiccontext.java:97) at Org.apache.ibatis.scripting.xmltags.dynamiccontext$contextaccessor.getproperty (DynamicContext.java:116) 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.ASTAnd.getValueBody ( astand.java:56) 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:310) at Org.apache.ibatis.scripting.xmltags.OgnlCache.getValue (ognlcache.java:45) at Org.apache.ibatis.scripting.xmltags.ExpressionEvaluator.evaluateBoolean (expressionevaluator.java:32) at Org.apache.ibatis.scripting.xmltags.IfSqlNode.apply (ifsqlnode.java:33) at Org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply (mixedsqlnode.java:32) at Org.apache.ibatis.scripting.xmltags.TrimSqlNode.apply (trimsqlnode.java:54) at Org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply (mixedsqlnode.java:32) at org.apache.iBATIS.SCRIPTING.XMLTAGS.DYNAMICSQLSOURCE.GETBOUNDSQL (dynamicsqlsource.java:40) at ORG.APACHE.IBATIS.MAPPING.MAPPEDSTATEMENT.GETBOUNDSQL (mappedstatement.java:278) at Org.apache.ibatis.executor.CachingExecutor.query (cachingexecutor.java:75) at Org.apache.ibatis.session.defaults.DefaultSqlSession.selectList (defaultsqlsession.java:108) at Org.apache.ibatis.session.defaults.DefaultSqlSession.selectList (defaultsqlsession.java:102) 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:358) ... More
Analysis:
So what happens when "there is no getter for property named in ' Class Java.lang.String '" error?
In fact, in this case:
<select id= "Getriskmember" resultmap= "Baseresultmap" parametertype= "String" > <include refid= " Selectmember "/> and safetylevel > 1 and stauts = 1 <if test=" Username! = null "> and username = #{username} </if> </select>
Note that it is the "there is no getter-named in ' Class Java.lang.String '" that occurs when the if test= is verified,
Instead of an error that occurs when and username = #{username}.
Workaround:
<select id= "Getriskmember" resultmap= "Baseresultmap" parametertype= "String" > <include refid= " Selectmember "/> and safetylevel > 1 and stauts = 1 <if test=" _parameter! = null "> and Username = #{username} </if> </select>
MyBatis problem: There is no getter for property named ' Unitid ' in ' Class java.lang.String '