import java.util.HashSet;
import java.util.Set;import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@Entity
public class UserInfo {                  private int id;                      
private String username;             
private String userpwd;              
private String userphone;           
private String others;              

private Set<HireInfo> hireinfos = new HashSet<HireInfo>(); 
private Set<Magdebrug> magdebrugs = new HashSet<Magdebrug>(); 

@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getUserpwd() {
return userpwd;
}
public void setUserpwd(String userpwd) {
this.userpwd = userpwd;
}
public String getUserphone() {
return userphone;
}
public void setUserphone(String userphone) {
this.userphone = userphone;
}
public String getOthers() {
return others;
}
public void setOthers(String others) {
this.others = others;
}

@OneToMany(mappedBy="userinfo")
public Set<HireInfo> getHireinfos() {
return hireinfos;
}
public void setHireinfos(Set<HireInfo> hireinfos) {
this.hireinfos = hireinfos;
}

@OneToMany(mappedBy="userinfo")
public Set<Magdebrug> getMagdebrugs() {
return magdebrugs;
}
public void setMagdebrugs(Set<Magdebrug> magdebrugs) {
this.magdebrugs = magdebrugs;
}
}public static void main(String[] args) {
Session session=HibernateSessionFactory.getSession();

}运行一下就可以了