[jBPM Users] - Re: Problem moving from 4.1 to 4.2 using Spring configuratio
by saraswati.santanu
Thanks for sharing the solution Suganda.
You have rightly pointed out that its always good to allow Spring to manage transaction when you use Spring-Hibernate combination. In fact you will not have an option other than this if you are using JMS or any non-db transactional service.
I, however, would disagree with you on the spring interceptor current= true option. This is normally OK to have not transaction in a thread to start with. Then somebody (for this case Spring) needs to start the transaction. Ans everybody else should use the existing transaction. If, say from web tier (from a servlet) first call goes to some Jbpm command service call then I would expect that to start the transaction and not to crib about not having a transaction. In such a case current=false makes more sense.
But again, with spring you can use OncePerRequestFilter kind of thing to get your transaction started. Such a case you have the option to use current=true.
I am sure everything remains same for JTA transaction, so there should be no more pain for you in this.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269126#4269126
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269126
16 years, 4 months
[jBPM Users] - Re: [jbpm 4.2] My first simple application doesn't work :(
by saraswati.santanu
Silver,
the code you have written is wrong. It will not work that way. You need to create a Jpdl file first. You can use the Eclipse GPD for that. And then use the Jbpm API to create ProcessDefinition etc. There is no class called ProcessFactory in Jbpm4.
Second point that you need to understand is that a ProcessDefinition can not be started, it is the ProecessInstance which should be started.
Now assuming you have created a flow jpdl xml file, then your main class should look like this:
| private static ProcessEngine processEngine;
|
| private static RepositoryService repositoryService;
| private static ExecutionService executionService;
|
| static {
| processEngine = Configuration.getProcessEngine();
|
| repositoryService = processEngine.get(RepositoryService.class);
| executionService = processEngine.getExecutionService();
| }
|
| /**
| * @param args
| */
| public static void main(String[] args) {
| //create new deployment object and ask it to deploy your flow
| String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("sampleprocess.jpdl.xml").deploy();
|
| //now we query the process definition
| ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deploymentId).uniqueResult();
|
| //start the process instance with the Id of the process definition
| ProcessInstance processInstance = executionService.startProcessInstanceById(processDefinition.getId());
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269124#4269124
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269124
16 years, 4 months