on 01-11-2012 2:30 AM
Hello
i've been work with this problem for a few days.
the problem is:
Generate Two Relational Table with Entity in EJB
1.Company Table
2.User Table
and Generate Session Bean CRUD Template
User
and Create a Webdyn Relate With Bean...(Everything is Drag and Drop with out coding)
add excute function for the Bean in wdInit() in Component Controller
and i got this Error
The initial exception that caused the request to fail, was:
com.sap.tc.webdynpro.progmodel.context.ContextException: NodeElement(.New1Comp.Request_CsrUserFacadeLocal_findAllCsrCompany): model node element cannot be created without a model instance
at com.sap.tc.webdynpro.progmodel.context.ModelNodeElement.<init>(ModelNodeElement.java:63)
at com.csr2.csr2.ui.wd.wd.comp.new1comp.wdp.IPublicNew1Comp$IRequest_CsrUserFacadeLocal_findAllCsrCompanyElement.<init>(IPublicNew1Comp.java:349)
at com.csr2.csr2.ui.wd.wd.comp.new1comp.wdp.IPublicNew1Comp$IContextNode.doCreateElement(IPublicNew1Comp.java:55)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.createElement(NodeInfo.java:1269)
at com.sap.tc.webdynpro.progmodel.context.Node.createElementInternal(Node.java:1104)
... 60 more
See full exception chain for details.
the Important thing is the two table are Relate for One to Many
and when i generate the Entity also reted two entity with One to Many
is there anything tutorial for doing this associate with Related Entity..?
please use the wizard to generate the code for model execution.
right click your component contrller-->apply template....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes i did
all code is generated
below is the code which generated by template in component Controller
//@@begin javadoc:wdDoInit()
/** Hook method called to initialize controller. */
//@@end
public void wdDoInit()
{
//@@begin wdDoInit()
//$$begin Service Controller0(-2133354062)
initRequest_CsrUserFacadeLocal_findAllCsrCompany();
executeCsrUserFacadeLocal_findAllCsrCompany();
//$$end
//@@end
}
public void initRequest_CsrUserFacadeLocal_findAllCsrCompany( ) {
//@@begin initRequest_CsrUserFacadeLocal_findAllCsrCompany()
//$$begin Service Controller0(-1205930989)
{
com.csr2.csr2.ui.wd.csruserfacade.mdl.CsrUserFacade csrUserFacadeModel = createAndMapModelInstance("com.csr2.csr2.ui.wd.csruserfacade.mdl.CsrUserFacade");
com.csr2.csr2.ui.wd.csruserfacade.mdl.Request_CsrUserFacadeLocal_findAllCsrCompany request_CsrUserFacadeLocal_findAllCsrCompany = wdContext.nodeRequest_CsrUserFacadeLocal_findAllCsrCompany().createAndAddRequest_CsrUserFacadeLocal_findAllCsrCompanyElement().modelObject();
com.csr2.csr2.ui.wd.csruserfacade.mdl.Response_CsrUserFacadeLocal_findAllCsrCompany response = new com.csr2.csr2.ui.wd.csruserfacade.mdl.Response_CsrUserFacadeLocal_findAllCsrCompany(csrUserFacadeModel);
request_CsrUserFacadeLocal_findAllCsrCompany.setResponse(response);
java.util.List<com.csr2.csr2.ui.wd.csruserfacade.mdl.CsrCompany> response_return = new java.util.ArrayList<com.csr2.csr2.ui.wd.csruserfacade.mdl.CsrCompany>();
response_return.add(new com.csr2.csr2.ui.wd.csruserfacade.mdl.CsrCompany(csrUserFacadeModel));
response.setReturn(response_return);
}
//$$end
//@@end
}
public void executeCsrUserFacadeLocal_findAllCsrCompany( ) {
//@@begin executeCsrUserFacadeLocal_findAllCsrCompany()
//$$begin Service Controller0(442559406)
try
{
wdContext.currentRequest_CsrUserFacadeLocal_findAllCsrCompanyElement().modelObject().execute();
} catch(EJBModelExecuteException e){
wdComponentAPI.getMessageManager().reportException( e.getMessage());
}
//$$end
//@@end
}
problem solved
my case is using Oracle Database
below is my Problem solving Guide
1.JPA doesn't surpport Object Entity
so change all Object to String if is OK
2.Using NWDS Genreate Tool does not add entity to public part and do it manually
3.if two relational entity used by bean set fatch type to eager
if someone need my sample, i would love to help...
but i think these issue is basic... referance hibernate and so on
Edited by: songbo piao on Jan 13, 2012 8:51 AM
Edited by: songbo piao on Jan 13, 2012 8:51 AM
already wrote it in my thread...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.