Problem Description:
The Hibernate entity class field int is generated as an integer java.lang.NoSuchMethodError, but obviously there is this method, but it has been said that there is no such method. After careful comparison of the bytecode file, the JDK is found in compiling bytecode, the relevant methods will be processed.
The detailed compilation situation is as follows:
Original code:
Net.setpushstatus (Integer.parseint (pushstatus));
Code that is compiled when the entity Class attribute field type is int:
Net.setpushstatus (Integer.parseint (pushstatus));
Code that is compiled when the Entity Class property field type is integer:
Net.setpushstatus (Integer.valueof (Integer.parseint (Pushstatus)));
In the process of converting int to Integer, the class that invokes the field's set method will silently recompile. Therefore, the newly compiled class file needs to be republished.
Similar problems:
1. Use static constants defined by the static final keyword , and if the constant needs to be changed after duty, then all class files that are used to this constant need to be republished.
Cause: Static constants are processed by the JDK directly when they are compiled. Therefore, it is useless to modify only the value of a constant when you modify it later.
Modify Hibernate entity class field int to generate Java.lang.NoSuchMethodError for integer