Code space Project--exception of Instantiationexception

Source: Internet
Author: User
Java.lang.InstantiationException
Instantiate the exception. This exception is thrown when an attempt is made to create an instance of a class through the newinstance () method, which is an abstract class or interface.

This project queries the type when using this exception, carefully check the entity class and Hibernate entity mapping files are one by one corresponding,
The reason for this error is that there is no constructor with no parameters in the entity class type, because Hibernate constructs the object using a constructor that takes no parameters in the object establishment.
And now my type class has only one constructor with parameters and a series of getter/setter methods.
There is a clear requirement in hibernate that each persisted class must have a constructor with no arguments.
So the solution is to add an parameterless construction method to the entity class, which does not have to do anything, just like the default construction method.

Code space Project--exception of Instantiationexception

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.