-
1. Re: How do I get a list of nodes?
peterj Aug 17, 2005 1:44 PM (in response to guillem)My code to pring out the node names looks almost like yours. I would guess that the myProcessDefinition valirable doesn't contain your process. Try printing out myProcessDefinition.getName() as see if you get "traspaso_propiedad".
-
2. Re: How do I get a list of nodes?
guillem Aug 18, 2005 3:12 AM (in response to guillem)I tried to print out the process definition name and i get "traspaso_propiedad". I've also checked in the database the table jbpm_node and the nodes are there with the correct process definition. Can't figure out what's wrong maybe something about beginTranscation() and commitTransaction()?
-
3. Re: How do I get a list of nodes?
aguizar Aug 18, 2005 12:22 PM (in response to guillem)Is the call to ProcessDefinition.getNodes() placed before you close your JbpmSession? Almost everything from the jBPM database is lazily loaded, and an empty collection is a typical symptom of a closed session.
-
4. Re: How do I get a list of nodes?
peterj Aug 18, 2005 12:36 PM (in response to guillem)I looked at my code and I have a beginTransaction before doing anything, and a commitTransaction after printing out all the names.
-
5. Re: How do I get a list of nodes?
guillem Aug 19, 2005 4:14 AM (in response to guillem)Now it works, i've looked in the jbpm_processdefinition table and checked that, actually there were two rows with the same version of the same processdefinition but in jpmb_node table all my nodes belonged to the second one, removing the first row has corrected the problem, now I must check why the "empty" :P thanks to everyone for the help ;)
-
6. Re: How do I get a list of nodes?
guillem Aug 19, 2005 5:13 AM (in response to guillem)Finally I've found out why there were two records for each process definition version, it was because my code to add one new process definition looked like:
ProcessDefinition myProcessDefinition = ProcessDefinition.parseXmlResource(myProcessDefinitionFile); jbpmSession.beginTransaction(); jbpmSession.getGraphSession().saveProcessDefinition(myProcessDefinition); jbpmSession.commitTransaction();
But GraphSession.saveProcessDefinition() saves it with its own transaction.
By removing my beginTransaction()/commitTransaction() the problem has been solved. -
7. Re: How do I get a list of nodes?
brittm Aug 19, 2005 11:03 AM (in response to guillem)I can't see how nested transacitons should duplicate the entry. That sounds more to me like a bug. I had come to the conclusion that
jbpmSession.getGraphSession().saveProcessDefinition(myProcessDefinition);
simply does not properly support versioning of the process definition. I use the following code instead and never have any problems:jbpmSession.beginTransaction(); ProcessArchiveDeployer pad = new ProcessArchiveDeployer(jbpmSessionFactory); String resource = request.getParameter("file"); if(resource.toUpperCase().endsWith(".XML")) { FileInputStream fis = new FileInputStream(resource); ProcessDefinition pd = ProcessDefinition.parseXmlInputStream(fis); //jbpmSession.getGraphSession().saveProcessDefinition(pd); //does not handle versioning pad.deployProcessDefinition(pd); }else if(resource.toUpperCase().endsWith(".PAR")) { pad.deployResource(resource); } jbpmSession.commitTransaction();
-Britt