[Solved] Hibernate Error: org.hibernate.InstantiationException: No default constructor for entity

Error performing load command: org.hibernate. InstantiationException: No default constructor for entity: : entity. User

Reason:

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.

All persistent classes must have a construction method without parameters (which is also the specification of JavaBean). Hibernate needs to use java reflection to create objects for you.
— from the official document hibernate getting started guide

Solution:

When the entity class declares other construction methods with parameters, you need to explicitly declare the construction methods without parameters.

Similar Posts: