'@实体@表(name ="student")公共类学生{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@Column(name = "first_name")
private String firstName;
@Column(name = "last_name")
private String lastName;
@Column(name = "email")
private String email;
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "student_detail_id")
private StudentDetail studentDetail;
public Student() {}
//获取器设置器'
'@实体@表(名称="学生明细")公共类学生明细{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@Column(name = "college")
private String college;
@Column(name = "no_of_problems_solved")
private int noOfProblemsSolved;
public StudentDetail() {}
@Column(name = "college")
private String college;
@Column(name = "no_of_problems_solved")
private int noOfProblemsSolved;
public StudentDetail() {}``
你能告诉为什么一对一双向Map不工作吗
1条答案
按热度按时间lsmepo6l1#
在Student_Detail中,还必须指定@OntToOne注解。
这应该对你有用。