Hi Somboon,
First of all, I would like to point you to the documentation here.
Now to answer your questions:
XPath<IMendixObject> xpath = XPath.create(getContext(), EntitiyToRetrieve.getType()); // Use the proxie of your entity: moduleName.proxies.entityName.getType()
List<IMendixObject> entityList = xpath.allMendixObjects();
//Set the association:
outSourceName.setValue(context, OutSourceName.MemberNames.outSourceName_outSourceCompany.toString(), outSourceCompany);
Thanks , Lennert Sietsma
I will try your solutuion.
I do workaround with my code , it can retrive dataList and insert data to entity. Is a good solution or not ?
List<OutSourceCompany> outSourceCompanyList = OutSourceCompany.load(getContext(), "[id!=empty]");
for(OutSourceCompany com: outSourceCompanyList){
System.out.println(com.getCompanyName());
company=com.getCompanyName();
OutsourceName outsourceName = new OutsourceName(getContext());
outsourceName.setOutsourceName("monkey"+com.getCompanyId());
outsourceName.setOutsourceTel("222"+com.getCompanyId());
outsourceName.setOutsourceName_OutSourceCompany(com);
outsourceName.commit();
}