脚本宝典收集整理的这篇文章主要介绍了Hibernate出现org.hibernate.InstantiationException: No default constructor for entity解决方法,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
Error performing load command : org.hibernate.InstantiationException: No default constructor for entity: : entity.User【原因】
The no-argument constructor, which is also a JavaBean convention, is a requirement for all persistent classes. Hibernate needs to create objects for you, using Java Reflection.
所有持久化类必须要求有不带参的构造方法(也是JavaBean的规范)。Hibernate需要使用Java反射为你创建对象。 ——来自官方文档《Hibernate Getting Started Guide》
【解决方法】
当实体类声明了其他带参构造方法时,需要显式声明不带参构造方法。
以上是脚本宝典为你收集整理的Hibernate出现org.hibernate.InstantiationException: No default constructor for entity解决方法全部内容,希望文章能够帮你解决Hibernate出现org.hibernate.InstantiationException: No default constructor for entity解决方法所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。