0
自己的孩子在這裏,我希望得到家長和孩子的他們的孩子。 這是我的Screen.
在這個屏幕我想保存所有的行。爲此我創建了follwing豆。
public class AdminComponentBean{
List<MultiAdminComponent> componentListbean;
}
另一個bean: -
public class MultiAdminComponent {
private String componentName;
private String componentIdentification;
private String componentType;
private String componentState;
private String componentUrl;
private String rowId;
private List<MultiAdminComponent> items;
}
在我的服務我嘗試檢索所有的孩子的。但我無法獲得父母的孩子。
List <MultiAdminComponent> adminComponentList = adminComponentBean.getComponentListbean();
for (MultiAdminComponent adminComponentListBean: adminComponentList) {
flag = BaseDAO.getAdminComponentDAOObject().saveParentComponentDetails(adminComponentListBean);//Here the parents will save but not the childs
for (MultiAdminComponent adminComponentchild: adminComponentListBean.getItems()) {//here I am trying to save childs
}
}
上面的代碼工作正常,並且在獲取數據時也需要編寫相同類型的遞歸方法? – Murali
https://stackoverflow.com/questions/45629162/how-to-get-parent-and-child-records-with-recursive-method – Murali
你可以調用相同的方法來獲取數據 –