Dynamic ViewObject refers to creating ViewObject at Runtime using SQL statement,
ApplicationModuleImpl has a method to create ViewObject using Sql statement i;e
Download -Sample ADF Application
ApplicationModuleImpl has a method to create ViewObject using Sql statement i;e
createViewObjectFromQueryStmt .
this method creates a readonly viewObject at runtime when query is processed in the method
Follow these simple steps-
First create a dummy ViewObject using dual
- Now add this ViewObject to Application Module
- I am doing this in managed bean, get application module and call method to create dynamic ViewObject get Application Module-
- Now Run your application and see-
public Object resolvElDC(String data) { FacesContext fc = FacesContext.getCurrentInstance(); Application app = fc.getApplication(); ExpressionFactory elFactory = app.getExpressionFactory(); ELContext elContext = fc.getELContext(); ValueExpression valueExp = elFactory.createValueExpression(elContext, "#{data." + data + ".dataProvider}", Object.class); return valueExp.getValue(elContext); } public dynamicAMImpl getAm() { dynamicAMImpl am = (dynamicAMImpl)resolvElDC("dynamicAMDataControl"); return am; }
create dynamic ViewObject-
ViewObject dynVo = getAm().getdynamic1(); dynVo.remove(); getAm().createViewObjectFromQueryStmt("dynamic1", query);
Download -Sample ADF Application