Error! Error! Error!

Source: Internet
Author: User

[11-07 10:55:28] [http-bio-8080-exec-2] [ERROR] [com. shinowit. dao. baseDAO-179]-Null value was assigned to a property of primitive type setter of com. shinowit. entity. TAuOperInfo. id
Org. hibernate. PropertyAccessException: Null value was assigned to a property of primitive type setter of com. shinowit. entity. TAuOperInfo. id

 

When a field value in the database is NULL and objects are persistently associated, an error occurs because this attribute of the object cannot be NULL. [Int type, cannot be blank]

 

As mentioned before, int type items cannot be empty.

Solution: define the type of the field in the class as Integer.

Difference between Integer code and int code:
Integer is the object code = null; the object can be null.
Int is a common type and cannot be null.
The code in the database can be empty, so it should be mapped to the Integer type. In addition, the java. long. Integer packaging class should be used in hibernate, and the basic type Integer should not be used.

Error! Error! Error!

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.