FinalDb db = FinalDb.create(this);User user = new User(); //这里需要注意的是User对象必须有id属性,或者有通过@ID注解的属性user.setEmail("mail@tsz.net");
user.setName("michael yang");
db.save(user);
FinalDB OneToMany懒加载使用方法:
模型定义:
public class Parent{ private int id; @OneToMany(manyColumn = "parentId") private OneToManyLazyLoader<Parent ,Child> children; /*....*/}public class Child{ private int id; private String text; @ManyToOne(column = "parentId") private Parent parent; /*....*/}
使用: