In the Java project development process for the spring+hibernate framework, you often encounter such errors:
could not find a getter for ... in class ...
can be caused as follows:
1. There is really no write getter method (occurrence: 1)
2.*.hmb.xml file property names and Pojo inconsistencies (*.hbm.xml and *.java are not connected well, Inconsistent), the field properties are not properly configured, for example, the address of the *.java in *.hmb.xml (explicitly indicates the full path of the reference package), mapping errors, and when multiple primary keys are configured incorrectly for the generated federated primary key, spelling errors (including multiple spaces), and so on (probability of occurrence: 48%)
3. Method Write wrong/method name write wrong, want to write according to JavaBean writing standard, otherwise hit to die also can not find where wrong (occurrence probability: 50%)
Here mention: Get/set is not allowed the method name has consecutive two uppercase letters, for example
Public String Getodptype () {
return this.odptype;
}
public void Setodptype (string odptype) {
This.odptype = Odptype;
}
If you write it in this way, you will report an error that the getter for Odptype is not found, but you can write the
public String odptype as follows;
Public String getodptype () {
return this.odptype;
}
public void Setodptype (string odptype) {
This.odptype = Odptype;
}
4. Other unknown cause (occurrence probability: 1)
(CSDN) To find the wrong way, follow the error information from the forward step by step to find, I encountered the error information solution is in the screenshot of the path of the file to solve.