Hello.
I have this method some where in a helper class:
Code:
public void bindMethodsElements(Node node, TemplateVersions tv, long wvId,
List<FormAction> pbs, List<FormActionParameter> pes) {
prepareSession();
WorkflowVersion wv = (WorkflowVersion) session.get(
WorkflowVersion.class, new Long(wvId));
deleteAllProc(node, tv);
for (int k = 0; k < pbs.size(); k++) {
TemplateActions ta = new TemplateActions();
ta.setTemplateVersions(tv);
ta.setNode(node);
ta.setWorkflowVersion(wv);
TemplateElements te = (TemplateElements) session.get(
TemplateElements.class, new Long(pbs.get(k).getBtnId()));
ta.setTemplateElements(te);
BusinessLogicMethods bm = (BusinessLogicMethods) session.get(
BusinessLogicMethods.class,
new Long(pbs.get(k).getProcId()));
ta.setBusinessLogicMethods(bm);
session.save(ta);
// get params
for (FormActionParameter formActionParameter : pes) {
if (formActionParameter.getMethodId() != ta.getBusinessLogicMethods().getId()
|| formActionParameter.getBtnId() != ta.getTemplateElements().getId()) {
continue;
}
TemplateActionsParams tap = new TemplateActionsParams();
tap.setTemplateActions(ta);
BusinessLogicMethodsParam pm = (BusinessLogicMethodsParam) session.get(BusinessLogicMethodsParam.class,
new Long(formActionParameter.getParamId()));
if (pm != null) { // not a return
tap.setBusinessLogicMethodsParam(pm);
tap.setParamType(formActionParameter.getParamType());
tap.setName(formActionParameter.getParamPureName());
} else {
tap.setBusinessLogicMethodsParam(null);
tap.setParamType(ta.getBusinessLogicMethods().getReturnType());
tap.setName("method return");
}
switch ((int) formActionParameter.getBindType()) {
case 0:
TemplateElements tpe = (TemplateElements) session.get(
TemplateElements.class, new Long(formActionParameter.getElmId()));
if (tpe != null) {
tap.setTemplateElements(tpe);
}
break;
case 1:
NodeInTokens nit = (NodeInTokens) session.get(
NodeInTokens.class, new Long(formActionParameter.getTokenId()));
if (nit != null) {
tap.setNodeInTokens(nit);
}
break;
case 2:
NodeOutTokens not = (NodeOutTokens) session.get(
NodeOutTokens.class, new Long(formActionParameter.getTokenId()));
if (not != null) {
tap.setNodeOutTokens(not);
}
break;
case 3:
// forcibly pm!=null
if (pm == null) {
return;
}
break;
default:
break;
}
session.save(tap);
}
}
System.out.println("start commit");
commitSession();
System.out.println("end commit");
}
sometimes this code stops executing in some point inside the loop or hangs in commitsession() call.
I don't know the reason.. I have faced this problem in other places without any advance in solving it.
please I need help I have a task should be achieved.