This was very wired error when creating viewObjects and ViewDef Objects on the fly and using dynamicForm tag.
I just used the code mentioned in Thirumalaisamy blog and created a method used as a common method when creating Def Objects.
public ViewDefImpl createDynamicViewDef(String packagePath, String viewName) {
PackageDefImpl newPackage;
java.lang.reflect.Method setParentMth;
try {
java.lang.reflect.Method mth =
MetaObjectManager.class.getDeclaredMethod("createContainerDefObject", new Class[] { boolean.class });
setParentMth = oracle.jbo.server.DefObject.class.getDeclaredMethod("setParent", new Class[] { oracle.jbo.common.NamedObjectImpl.class });
mth.setAccessible(true);
setParentMth.setAccessible(true);
newPackage = (PackageDefImpl)mth.invoke(MetaObjectManager.getSingleton(), new Object[] { true });
} catch (Exception ex) {
throw new JboException(ex);
}
newPackage.setDefScope(PackageDefImpl.DEF_SCOPE_SESSION);
newPackage.setName(packagePath);
newPackage.setFullName(packagePath);
MetaObjectManager.insertSessionMetaObject(newPackage.getFullName(), newPackage);
ViewDefImpl reportParamsViewDef = new ViewDefImpl(packagePath + "." + viewName);
reportParamsViewDef.setFullName(packagePath + "." + viewName);
reportParamsViewDef.setComponentClass(ViewObjectImpl.class);
try {
setParentMth.invoke(reportParamsViewDef, new Object[] { newPackage });
} catch (Exception ex) {
ex.printStackTrace();
throw new JboException(ex);
}
return reportParamsViewDef;
}
Many thanks to Thirumalaisamy Thangavel who started the whole topic with oracle support
http://thirumalaisamyt.blogspot.com/2013/04/life-of-dynamic-vo-eo-across.html
No comments:
Post a Comment