我试图找出如何定义一对一的关系,给出以下先决条件/注意在Schedule类/中没有对Activity的引用。我无法插入两个键。我在这里看one-to-one但仍无法使其工作 - 活动中的Schedule主键未插入:
有2个表:
activity table
activity_id
name
...
schedule (fk schedule)
schedule table
schedule id
name
..
activity_id(fk activity)
的POJO:
class Activity{
private int activity_id;
private String name;
private Schedule schedule;
..
getters + setters
}
class Schedule{
private int schedule_id;
private String name;
..
getters + setters
}