Today using the MyBatis connection database times out of the java.lang.NoSuchMethodException error, the error message is as follows,
Error tip, the error location is the player's Bean class instantiation is wrong, the player code is as follows
public class Player {private int pid;
Private String pname;
private String position;
private int CID;
Private Club club;//a many-to-many relationship public int getpid () {return PID;
public void setpid (int pid) {this.pid = pid;
Public String Getpname () {return pname;
} public void Setpname (String pname) {this.pname = PName;
Public String getPosition () {return position;
} public void SetPosition (String position) {this.position = position;
public int getcid () {return CID;
public void Setcid (int cid) {this.cid = CID;
Public Club Getclub () {return club;
public void Setclub (club club) {this.club = Club;
public Player (int pid, string pname, string position, int CID, club club) {super ();
This.pid = pid;
This.pname = PName;
This.position = position;
This.cid = CID;
This.club = Club; @Override public String toString () {return "Player [pid= + pid +", pname= "+ PName +", position= "+ Position +"
, cid= "+ CID +"]; }
}
The last thing I found was that I wrote a parametric construct at the end of the code, overloaded the constructor, and MyBatis, when loading into a bean class, required a parameterless construct to cause the error.
Solution, to the code plus the morning parameter construction can be.
Public Player () {
super ();
}