level 1
李李李李格尔楞
楼主
代码如下:
@Entity
public class Husband {
private int id;
private String name;
private int age;
private Wife wife;
@Id
@GeneratedValue
public int getId() {
return id;
}
public String getName() {
return name;
}
@OneToOne
public Wife getWife() {
return wife;
}
public int getAge() {
return age;
}
public void setId(int id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setWife(Wife wife) {
this.wife = wife;
}
public void setAge(int age) {
this.age = age;
}
}

为什么age 的NULL值 为NO呢? 主键只有id啊
2014年07月21日 07点07分
1
@Entity
public class Husband {
private int id;
private String name;
private int age;
private Wife wife;
@Id
@GeneratedValue
public int getId() {
return id;
}
public String getName() {
return name;
}
@OneToOne
public Wife getWife() {
return wife;
}
public int getAge() {
return age;
}
public void setId(int id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setWife(Wife wife) {
this.wife = wife;
}
public void setAge(int age) {
this.age = age;
}
}

为什么age 的NULL值 为NO呢? 主键只有id啊