菜鸟问Mybatis 关联关系 怎么配置
两张表的实体类:
package model;
import java.util.HashSet;
import java.util.Set;
/**
* Project entity. @author MyEclipse Persistence Tools
*/
public class Project implements java.io.Serializable {
// Fields
private int id;
private String projectname;
private Set workorders = new HashSet(0);
// Constructors
/** default constructor */
public Project() {
}
/** minimal constructor */
public Project(int id, String projectname) {
this.id = id;
this.projectname = projectname;
}
/** full constructor */
public Project(int id, String projectname, Set workorders) {
this.id = id;
this.projectname = projectname;
this.workorders = workorders;
}
// Property accessors
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
public String getProjectname() {
return this.projectname;
}
public void setProjectname(String projectname) {
this.projectname = projectname;
}
public Set getWorkorders() {
return this.workorders;
}
public void setWorkorders(Set workorders) {
this.workorders = workorders;
}
}
package model;
import java.util.Date;
/**
* Workorder entity. @author MyEclipse Persistence Tools
*/
public class Workorder implements java.io.Serializable {
// Fields
private int id;
private Project project;
private String executor;
private String description;
private int orderlevel;
private Date createdate;
// Constructors
/** default constructor */
public Workorder() {
}
/** full constructor */
public Workorder(int id, Project project, String executor,
String description, int orderlevel, Date createdate) {
this.id = id;
this.project = project;
this.executor = executor;
this.description = description;
this.orderlevel = orderlevel;
this.createdate = createdate;
}
// Property accessors
public Workorder(Project project, String executor, String description,
int orderlevel, Date createdate) {
super();
this.project = project;
this.executor = executor;
this.description = description;
this.orderlevel = orderlevel;
this.createdate = createdate;
}
public Workorder(String executor, String description, int orderlevel,
Date createdate) {
super();
this.executor = executor;
this.description = description;
this.orderlevel = orderlevel;
this.createdate