Closed gongshoudao closed 3 years ago
saveAll
skips saving the many to many models for performance reasons. It is best to save each individual model in a transaction. Looks like all of *all
methods do not respect one to many or model caching. Ill elevate to a bug since its not really expected.
in meantime i would loop through each model:
models.forEach { model -> modelAdapter.save(model) }
in develop
.
ISSUE_TEMPLATE
DBFlow Version: 4.2.4 Bug or Feature Request: Bug Description: FlowManager.getModelAdapter(XXX.class).saveAll(models) not working with oneToMany
eg.: 1.an ArrayList in XXX.class ;
2.
public class XXX extends BaseModel { private ArrayList giftList;
@OneToMany(methods = {OneToMany.Method.DELETE, OneToMany.Method.SAVE}, variableName = "giftList")
public ArrayList getDescList() {
return giftList;
}
}//end XXX.java
3.
FlowManager.getModelAdapter(XXX.class).saveAll(models)
XXX list save success , but XXX.giftList haven't.