[jboss-jira] [JBoss JIRA] Commented: (JBPM-711) Provide an arbitrary identifier for stored ProcessInstances

Ronald van Kuijk (JIRA) jira-events at jboss.com
Wed Jul 26 17:54:11 EDT 2006


    [ http://jira.jboss.com/jira/browse/JBPM-711?page=comments#action_12340129 ] 
            
Ronald van Kuijk commented on JBPM-711:
---------------------------------------

Ryan, 

This can be done by setting a processvariable when a process is created and not saved yet. After saving, looking a processinstance up by searching for this specific processvariable and it's value. This currently is not in the api but an example is in the jbpm webapp of version 3.1:


	public String searchInstances() {

		long count = 0;
		
        JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();

		try {
			Connection connection = jbpmContext.getConnection();
			Statement statement = connection.createStatement();
			statement.setMaxRows(100);
			
			String request = "SELECT DISTINCT processinstance_, name_, stringvalue_  FROM jbpm_variableinstance " 
						+ "WHERE name_ "
						+ this.variableNameOperator + " '" 
						+ variableName + "' AND stringvalue_ "
						+ this.variableValueOperator + " '" + variableValue + "'";

			ResultSet resultSet = statement.executeQuery(request);
			
			processInstances = new ArrayList();
			
			while (resultSet.next()) {
				processInstances.add(new ProcessInstanceBean(
						resultSet.getLong("processinstance_"),
						resultSet.getString("name_"),
						resultSet.getString("stringvalue_")));
				count++;
			}
			statement.close();
		}
		catch (Exception e) {
			this.message = "Search error " + e.getMessage();
		}
		
		if (count == 1) {
			ProcessInstanceBean processInstanceBean = (ProcessInstanceBean)processInstances.iterator().next();
			FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("processInstanceBean", processInstanceBean);
			return("inspectInstance");	
		}
		return "";
	}


Maybe this should be 'hibernated' but that is not my expertise. 

The ID issue is in fact an hibernate issue. It is possible to have it returned earlier when using other id generators, but it also depends on the db afaik (iane)

> Provide an arbitrary identifier for stored ProcessInstances
> -----------------------------------------------------------
>
>                 Key: JBPM-711
>                 URL: http://jira.jboss.com/jira/browse/JBPM-711
>             Project: JBoss jBPM
>          Issue Type: Feature Request
>          Components: Core Engine
>    Affects Versions: jBPM 3.1
>            Reporter: Ryan Campbell
>         Assigned To: Tom Baeyens
>             Fix For:  jBPM 3.1.2
>
>
> When a process instance is created and then saved, an id is returned.  If there is a server crash before that id is returned and saved, there is no way to know if the process was created.
> We would like to have mapping between our own arbitrary ids for a process instance so that we can recover a process instance. ie, recreate it if it was not created successfully.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list