There is no setter for property named 'empId' in 'class com.my.entity.Dept'
来源:互联网 发布:重庆网络教育报名 编辑:程序博客网 时间:2024/05/17 00:05
异常信息
log4j:WARN No appenders could be found for logger (org.apache.ibatis.logging.LogFactory).
log4j:WARN Please initialize the log4j system properly.
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property 'empId' of 'class com.my.entity.Dept' with value '4' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'empId' in 'class com.my.entity.Dept'
### The error may exist in com/my/mapper/EmpMapper.xml
### The error may involve com.my.mapper.EmpMapper.selectEmpDeptOne
### The error occurred while handling results
### SQL: select emp.*,dept.* from emp inner join dept on dept.dept_id=emp.dept_id where emp.emp_id=?
### Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property 'empId' of 'class com.my.entity.Dept' with value '4' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'empId' in 'class com.my.entity.Dept'
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
at com.sun.proxy.$Proxy7.selectEmpDeptOne(Unknown Source)
at com.my.dao.impl.EmpDaoMapperImpl.selectEmpDeptOne(EmpDaoMapperImpl.java:17)
at com.my.test.EmpTest.testSelectEmpDeptOne(EmpTest.java:27)
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.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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
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.reflection.ReflectionException: Could not set property 'empId' of 'class com.my.entity.Dept' with value '4' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'empId' in 'class com.my.entity.Dept'
at org.apache.ibatis.reflection.wrapper.BeanWrapper.setBeanProperty(BeanWrapper.java:185)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.set(BeanWrapper.java:59)
at org.apache.ibatis.reflection.MetaObject.setValue(MetaObject.java:140)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.applyPropertyMappings(DefaultResultSetHandler.java:450)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getRowValue(DefaultResultSetHandler.java:912)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForNestedResultMap(DefaultResultSetHandler.java:877)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:324)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:299)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:192)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
... 32 more
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'empId' in 'class com.my.entity.Dept'
at org.apache.ibatis.reflection.Reflector.getSetInvoker(Reflector.java:411)
at org.apache.ibatis.reflection.MetaClass.getSetInvoker(MetaClass.java:168)
at org.apache.ibatis.reflection.wrapper.BeanWrapper.setBeanProperty(BeanWrapper.java:177)
... 48 more
问题原因:Mybatis的配置文件中的别名错误
总结:复制的代码一定要再仔细检查一遍
- There is no setter for property named 'empId' in 'class com.my.entity.Dept'
- There is no setter for property named 'storeId' in 'class com.auth.entity.Auth'
- bug解决:There is no getter for property named 'new_driver_id' in 'class com.bjw.entity.Driver'
- There is no getter for property named 'insurance_id' in 'class studio.geek.entity.StudentInsurance'
- There is no getter for property named 'xxx' in 'class.....'
- Mybatis-异常-There is no getter for property named 'VARCHAR' in 'class com.xxx.xxxxx
- There is no getter for property named 'xxx' in 'class com.xuezhixin.mls.web.model.yyy
- There is no getter for property named 'depart' in 'class com.xuezhixin.mls.web.model.Major'
- [SSM]There is no getter for property named 'token_exptime' in 'class com.hdu.model.Student'
- There is no getter for property named 'itmesCustom' in 'class com.ssm.po.Ite
- There is no getter for property named 'value' in 'class com.hl.myabtis.first.beas.User'
- There is no getter for property named 'ypxxCustom'in'class com.onespace.ypcg.pojo.GysypmlQueryVo'
- There is no getter for property named 'user' in 'class com.gao.model.Message
- .ReflectionException: There is no setter for property named XXX
- 关于myBatis的问题There is no getter for property named 'USER_NAME' in 'class com.bky.model.实例类'
- com.ibatis.common.beans.ProbeException: There is no READABLE property named 'propertyName' in class 'className'
- There is no WRITEABLE property named 'unitcoefficient' in class 'com.rhyton.pems.core.domain.EnergyM
- com.ibatis.common.beans.ProbeException: There is no READABLE property named 'baiduIndex' in class 'j
- XListView中运用到的两个方法及下拉刷新时时间设置
- python3爬取淘女郎图片
- Nodejs 学习(三)--文件操作
- AngularJS+清空购物车+全选+sort排序
- 剑指offer之重建二叉树(Python)
- There is no setter for property named 'empId' in 'class com.my.entity.Dept'
- Hibernate中HQL语句
- HDU
- 2017.10.11离线赛总结
- VMware虚拟机不能联网(xshell不能远程连接虚拟机)
- Caffe分类网训练流程
- 项目总结之车牌识别
- struct和typedef struct的用法和区别
- OkHttp请求数据到RecyclerView多条目展示