Hi,
利用hibernate-tool生成pojo类的时候,如果一个表中有外键关系,那么会将那个域生成引用类的类型,如下所示:
1. The SQL for tables:
create table teacher
(
t_id number(10) primary key,
t_name varchar(10) not null
);
create table student
(
s_id number(10) primary key,
t_id number(10) references teacher(t_id),
s_name varchar(50) not null
);
2. 生成的pojo:
public class Teacher implements java.io.Serializable
{
private longTId;
private StringTName;
private Set<Student>students= new HashSet<Student>(0);
}
public class Student implements java.io.Serializable
{
private longSId;
private Teacherteacher;
private StringSName;
}
3. 我想生成的pojo:
public class Teacher implements java.io.Serializable
{
private longTId;
private StringTName;
}
public class Student implements java.io.Serializable
{
private longSId;
private long t_id;
private StringSName;
}
请问,我该怎么做?才能达到这一的目的呢?