[JBoss jBPM] - how list processes?
by simonbaker
If you have a workflow process definition and create multiple instances of the process, is there a way to get a list of all the processes that you have started?
Let's say we have a method to start processes as follows, with a static jbpmConfiguration member visible somewhere and using hibernate for persistence:
| public long startProcess(String orgNumber, String suborgNumber) throws RMSException{
| long processID = -1;
| log.info("Entering startEfileDestructionProcess");
|
| //Check if the jbpmConfiguration has been setup
| if( jbpmConfiguration == null ){
| //retrieve it
| log.info("JBPMConfiguration was null, creating instance.");
| jbpmConfiguration = JbpmConfiguration.getInstance();
| }
|
| //Doing a try and catch for all so the RMSException can contain the relevant info
| // Lookup the pojo persistence context-builder that is configured above
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| log.info("Retrieved jbpmContext.");
| try {
|
|
| //GraphSession graphSession = jbpmContext.getGraphSession();
|
| //ProcessDefinition processDefinition =
| log.info("Creating process");
|
| // With the processDefinition that we retrieved from the database, we
| // can create an execution of the process definition just like in the
| // hello world example (which was without persistence).
| ProcessInstance processInstance = jbpmContext.newProcessInstance("JBPMEfileProcess");
| log.info("Created process");
| processID = processInstance.getId();
| log.info("ProcessID is ["+processID+"]");
|
| //Set the key variables
| processInstance.getContextInstance().createVariable("OrgNumber",orgNumber);
|
| log.info("Set Org Number");
| processInstance.getContextInstance().createVariable("SubOrgNumber",suborgNumber);
| log.info("Set SubOrg Number");
|
| // Now the processInstance is saved in the database. So the
| // current state of the execution of the process is stored in the
| // database.
| //Connection myConnect = jbpmContext.getConnection();
| //PreparedStatement myStatement = myConnect.prepareStatement("SET IDENTITY_INSERT JBPM_PROCESSINSTANCE OFF");
| //myStatement.execute();
| //myStatement.close();
| processInstance.signal();
| jbpmContext.save(processInstance);
| log.info("Saved New Process");
| }catch(Exception e){
| String message = "Error creating new RMS process["+e.getMessage()+"]";
| e.printStackTrace();
| throw new RMSException(1,message);
| }
| finally {
| // Tear down the pojo persistence context.
| jbpmContext.close();
| }
|
| log.info("Exiting startEfileDestructionProcess, created processID["+processID+"]");
| return processID;
| }
|
Is there a way to get a list of all the processes, short of saving the process ids myself somewhere?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043533#4043533
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043533
19 years
[JBoss jBPM] - Re: JBPM Timer Problem
by avivstav
I overcome the problems described above, now I get the following error:
| 2007-05-06 18:41:19,328 ERROR [org.jbpm.job.executor.JobExecutorThread] exception in job executor thread. waiting 5000 milliseconds
| org.hibernate.HibernateException: hibernate.cfg.xml not found
| at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
| at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1329)
| at org.hibernate.cfg.Configuration.configure(Configuration.java:1351)
| at org.jbpm.db.hibernate.HibernateHelper.createConfiguration(HibernateHelper.java:91)
| at org.jbpm.persistence.db.DbPersistenceServiceFactory.getConfiguration(DbPersistenceServiceFactory.java:69)
| at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
| at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:94)
| at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:98)
| at org.jbpm.persistence.db.DbPersistenceService.getJobSession(DbPersistenceService.java:352)
| at org.jbpm.JbpmContext.getJobSession(JbpmContext.java:563)
| at org.jbpm.job.executor.JobExecutorThread.acquireJobs(JobExecutorThread.java:109)
| at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:56)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043527#4043527
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043527
19 years
[Persistence, JBoss/CMP, Hibernate, Database] - Qualifying table with schema name
by suneetshah2000
Hello,
All of my sql statements being generated by hibernate are being qualified by the schema or database name. Is there anyway to prevent this? I have updated the hibernate maps to exclude this, but they are still being qualified so I am not sure where this information is being set.
| <hibernate-mapping default-lazy="false">
| <class name="diamelle.common.service.RequestApprover" table="request_approver">
| <comment></comment>
| <id name="requestApproverId" type="string">
| <column name="REQUEST_APPROVER_ID" length="20" />
| <generator class="assigned" />
| </id>
| <many-to-one name="service" class="diamelle.common.service.Service" fetch="select">
| <column name="SERVICE_ID" length="20">
| <comment></comment>
| </column>
| </many-to-one>
| <property name="approverType" type="string">
| <column name="APPROVER_TYPE" length="20">
| <comment></comment>
| </column>
| </property>
| <property name="approverId" type="string">
| <column name="APPROVER_ID" length="20">
| <comment></comment>
| </column>
| </property>
| <property name="approvalLevel" type="string">
| <column name="APPROVAL_LEVEL" length="20">
| <comment></comment>
| </column>
| </property>
| </class>
| </hibernate-mapping>
|
|
Thanks
Suneet
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4043525#4043525
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4043525
19 years