其他分享
首页 > 其他分享> > No constructor found in domain

No constructor found in domain

作者:互联网

### Cause: org.apache.ibatis.executor.ExecutorException: No constructor found in domain.User matching [java.lang.Integer, java.lang.String, java.sql.Timestamp, java.lang.String, java.lang.String]
	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.binding.MapperMethod.executeForMany(MapperMethod.java:137)
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
	at com.sun.proxy.$Proxy3.findAll(Unknown Source)
	at test.MybatisTest.main(MybatisTest.java:26)

出问题代码

        List<User> users=userDao.findAll();

问题原因:
在List所定义的User类型中只创建了有参构造函数,没有无参构造函数,导致了该问题的出现,在User中添加一个无参构造函数即可解决

标签:lang,domain,java,org,ibatis,constructor,apache,found,DefaultSqlSession
来源: https://blog.csdn.net/qq_33645786/article/details/110703858