各位大神,小弟自學java,今天學習逆向工程時,在生成的實體類中不能生成引用關系,,,
powerdesigner生成的物理模型如圖:
drop table if exists company;
/*==============================================================*/
/* Table: company /
/==============================================================*/
create table company
(
comp_id varchar(32) not null,
comp_name varchar(80) not null,
comp_address varchar(100),
comp_desc text,
primary key (comp_id)
);
drop table if exists department;
/*==============================================================*/
/* Table: department */
/*==============================================================*/
create table department
(
dept_id varchar(32) not null,
comp_id varchar(32) not null,
dept_name varchar(20) not null,
primary key (dept_id)
);
alter table department add constraint FK_company—department foreign key (comp_id)
references company (comp_id) on delete restrict on update restrict;
/*==============================================================*/
/* Table: employee /
/==============================================================*/
create table employee
(
emp_id varchar(32) not null,
dept_id varchar(32) not null,
emp_name varchar(20) not null,
primary key (emp_id)
);
alter table employee add constraint FK_department——employee foreign key (dept_id)
references department (dept_id) on delete restrict on update restrict;
hibernate逆向時沒有生成set集合,也沒有引用,更不存在關聯關系
生成的實體類代碼如下:
package entity;
/**
* Employee entity. @author MyEclipse Persistence Tools
*/
public class Employee implements java.io.Serializable {
// Fields
private String empId;
private String deptId;
private String empName;
// Constructors
/** default constructor */
public Employee() {
}
/** full constructor */
public Employee(String deptId, String empName) {
this.deptId = deptId;
this.empName = empName;
}
// Property accessors
public String getEmpId() {
return this.empId;
}
public void setEmpId(String empId) {
this.empId = empId;
}
public String getDeptId() {
return this.deptId;
}
public void setDeptId(String deptId) {
this.deptId = deptId;
}
public String getEmpName() {
return this.empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}
}
package entity;
/**
* Department entity. @author MyEclipse Persistence Tools
*/
public class Department implements java.io.Serializable {
// Fields
private String deptId;
private String compId;
private String deptName;
// Constructors
/** default constructor */
public Department() {
}
/** full constructor */
public Department(String compId, String deptName) {
this.compId = compId;
this.deptName = deptName;
}
// Property accessors
public String getDeptId() {
return this.deptId;
}
public void setDeptId(String deptId) {
this.deptId = deptId;
}
public String getCompId() {
return this.compId;
}
public void setCompId(String compId) {
this.compId = compId;
}
public String getDeptName() {
return this.deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
}
package entity;
/**
* Company entity. @author MyEclipse Persistence Tools
*/
public class Company implements java.io.Serializable {
// Fields
private String compId;
private String compName;
private String compAddress;
private String compDesc;
// Constructors
/** default constructor */
public Company() {
}
/** minimal constructor */
public Company(String compName) {
this.compName = compName;
}
/** full constructor */
public Company(String compName, String compAddress, String compDesc) {
this.compName = compName;
this.compAddress = compAddress;
this.compDesc = compDesc;
}
// Property accessors
public String getCompId() {
return this.compId;
}
public void setCompId(String compId) {
this.compId = compId;
}
public String getCompName() {
return this.compName;
}
public void setCompName(String compName) {
this.compName = compName;
}
public String getCompAddress() {
return this.compAddress;
}
public void setCompAddress(String compAddress) {
this.compAddress = compAddress;
}
public String getCompDesc() {
return this.compDesc;
}
public void setCompDesc(String compDesc) {
this.compDesc = compDesc;
}
}
求大神幫忙解決
http://www.2cto.com/database/201412/357867.html