org.apache.ibatis.executor.ExecutorException: No constructor found in com.nwl.entity.Person matching [java.lang.Integer, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.String]

org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.apache.ibatis.executor.ExecutorException: No constructor found in com.nwl.entity.Person matching [java.lang.Integer, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.String]
### The error may exist in com/nwl/mapper/PersonMapper.xml
### The error may involve com.nwl.mapper.PersonMapper.getById
### The error occurred while handling results
### SQL: select * from mybatis_person,mybatis_idencard         where mybatis_person.id=?           and mybatis_person.card_id=mybatis_idencard.id
### Cause: org.apache.ibatis.executor.ExecutorException: No constructor found in com.nwl.entity.Person matching [java.lang.Integer, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.String]

mybatis一对一映射,已经查询出结果,但是没有封装到对象中

经过网上搜索是因为实体类没有默认的构造方法,把构造方法加上之后问题就解决了

public Person() {
    }

 

 

参考:https://blog.csdn.net/zuihongyan518/article/details/91448016

posted @ 2021-11-04 17:18  0牛牛牛  阅读(75)  评论(0)    收藏  举报