我有一个要保存到数据库的顶级元素,它有几个外部元素,如下所示:
@DatabaseTable
public class Parent {
@DatabaseField(id = true, index = true)
public Integer id;
@DatabaseField(foreign = true)
public ChildA a;
}
@DatabaseTable
public class ChildA {
DatabaseField(generatedId = true, index = true)
public Integer id;
@DatabaseField
public boolean something;
}
假设这些已经在数据库中创建。现在我想更新它们。调用会parentDao.update(parent)
更新两者吗?还是我也需要手动更新孩子?