我的一个OrmLite类/表对于它自己的好处来说太大了,需要重构。我想把这个班级拆分而不拆分桌子。
重构之前:
@DatabaseTable(tableName = "Table") public class Employee {
@DatabaseField(generatedId = true) final private int id;
@DatabaseField final private String name;
@DatanaseField final private String address;
}
重构后:
@DatabaseTable(tableName = "Table") public class Employee {
@DatabaseField(generatedId = true) final private int id;
@DatabaseField final private String name;
@DatabaseField(foreign = true) final private Address;
}
@DatabaseTable(tableName = "Table") public class Address {
@DatabaseField(generatedId = true) final private int id;
@DatabaseField final private String address;
}
这是否可行或者我必须拆分表以使用外来字段吗?