Exception Org.hibernate.InstantiationException:No default constructor for entity
The entity class that is returned when the query is an object instance is the one that hibernate dynamically generates through reflection.
The reflected Class.forName ("ClassName"). newinstance (); requires a corresponding class to provide a parameterless constructor,
This problem occurs when the entity class has a parameter structure, and there is no parameterless structure .
The following is a reference structure and a non-parametric structure .
1, each class in the default case, there will be a parameterless constructor!
2, when the parameter constructor is declared, then the parameterless constructor does not exist and requires a parameterless constructor, it must be re-declared!
3, the constructor is not capable of inheriting
4, in the class constructor, whether it is an argument or a parameterless constructor, by default, the parameterless constructor of the parent class is called first (all the way to the topmost parent), because the method to invoke the parent class inherits must first initialize the parent class.
5, you need to call the parent class constructor in the subclass constructor to display the declaration.
No default constructor for entity java no parameter constructor