实体类
public class Company {
@Id
private int id;
@Name
private String name;
@Column
private int ceoId;
@One(target = Employee.class, field = "ceoId")
private Employee CEO;
}
public class Employee {
@Id
private int id;
@Name
private String name;
@Column
private int age;
}
module
@At
public void testInsertWith(){
Company c=new Company();
c.setName("Apple");
Employee e=new Employee();
e.setName("steve");
e.setAge(40);
c.setCEO(e);
//插入关联数据
dao2.insertWith(c,"CEO");
}
这是没问题的 但是如果我想把Employee 改造成这个样子
public class Employee {
@Id
private int id;
@Name
private String name;
@Column
private int ceoId;
@Column
private int age;
}
让Employee Id自增 Company表的ceoId字段对应Employee 表的ceoId字段 如何实现呢?