Original address: http://blog.csdn.net/kevinzhangfei/article/details/6995316
The "null value is assigned to a property of primitive type setter of" error was reported during the action request data, and was discovered after the search because the corresponding field in the database was Null.
For example:
Java code
<!--The fields in the Hibernate mapping file--
<property name="printtime" type="Long" ><column name="Print_time"/></property>
[Java]View plain?
- <!--The fields in the Hibernate mapping file--
- <property name="printtime" type="Long" ><column name="Print_time"/></property>
Where the type is hibernate type, in the generated class, the Printtime field is a long type, is a base type, and cannot be null.
Workaround:
First: The database field is not set to null;
The second kind: Manually modify the mapping file, printtime use Java type Long, that is, type= "Java.lang.Long", The Book class field is also changed to Long. Similarly, int is an integer.
Third: Use Java type instead of hibernate type when reverse engineering.
Go Null value is assigned to a property of primitive type setter of "cause and resolution