No default constructor for entity: com.integration.entity.Info; nested exception is org.hibernate.I

一、有入下异常

No default constructor for entity: com.integration.entity.Info; nested exception is org.hibernate.I

1.报错原因

没有实体的默认构造函数:com . integration . entity . Info;嵌套异常是org . hibernate . instantionException:没有实体的默认构造函数:com.integration.entity.Info

很明显,由hibernate所管理的bean类Info并未成功构造,问题出现在Info类上。下图为报错时所写Info类,很明显跟我们学MVC时常写的bean类格式并无差别,而就是种方式造成的错误。

No default constructor for entity: com.integration.entity.Info; nested exception is org.hibernate.I

2.参考解决方法 

将bean修改为如下图后,异常解决,读者可仔细对比其区别

No default constructor for entity: com.integration.entity.Info; nested exception is org.hibernate.I