ADF - Programatically create/update viewObject


  • Instance of AM and get VO
 
//instance of AM
PatientAMImpl patientAM =
(PatientAMImpl) Configuration.createRootApplicationModule("......................model.patient.am.PatientAM",
"PatientAMLocal");
//getVO
PatientViewImpl vo = patientAM.getPatientView1();
  /* code of ROW, case update or create
*/
Configuration.releaseRootApplicationModule(patientAM, true);


  • Create Row
 
Row patienRow = vo.createRow();
patienRow.setAttribute("PatNo", 4);
patienRow.setAttribute("Name", "source Teste");

vo.insertRow(patienRow);
patientAM.getDBTransaction().commit();
vo.executeQuery();


  • Update Row

 
  Row [] rows = vo.findByKey(new Key(new Object[]{KEY}), 1);
rows[0].setAttribute("Name", "Joao Updated");
rows[0].setAttribute("Morada", " Street 9");

patientAM.getDBTransaction().commit();




Related Posts:

No responses yet for "ADF - Programatically create/update viewObject"

Post a Comment