Thursday, January 19, 2012

ADF 11G : Create/update Row Programatically(Entity Object)

Put below code inside EOImpl.java
------------------------------------------

public void createDept(String deptId, String deptName){
System.out.println("-1-");
String entityName = "model.Dept";
System.out.println("-2-");
EntityDefImpl deptDef = EntityDefImpl.findDefObject(entityName);
System.out.println("-3-");
EntityImpl newDept = deptDef.createInstance2(getDBTransaction(), null); System.out.println("-4-");
newDept.setAttribute("DeptId", deptId);
newDept.setAttribute("DeptName", deptName);
System.out.println("-5-");
try{
getDBTransaction().commit();
System.out.println("try");
}catch(JboException ex){
System.out.println("try");
throw ex;
}
}


http://jneelmani.blogspot.in/2013/05/adf-11g-how-to-insert-row.html
**************************************************************
public void updateDeptName(String deptId, String deptName){

EntityImpl dept = (findDepartment(deptId);
if(dept != null){
dept.setAttribute("DepartmentName", deptName);
try{ getDBTransaction().commit();
}catch(JboException ex){
getDBTransaction().rollback();
throw ex;
}
}
}
http://jneelmani.blogspot.in/2013/05/adf-11g-how-to-edit-row-programatically.html
http://jneelmani.blogspot.in/2013/05/adf-11g-how-to-remove-row.html