Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Persist Data In Jbpm 5.4

I wanted to know if there is any example or link available which explains us Step by Step How to persist data in JBPM?

I wanted to make an web App in the sense a user registration form where when a user/human fills the form and clicks on submit button and after that data should be stored in table in my database that is MySQl database.

Any Help on it is appreciated.

Thanks.

like image 318
Dhaval Shah Avatar asked Feb 07 '13 05:02

Dhaval Shah


1 Answers

I have been struggling with this for the past few days. I have using the JBPM 6.1.0.Final build. I used this maven example webapp project. Quick warning about environment setup: I could only get the project to deploy in JBoss EAP 6.3. I tried in Wildfly 8.1 and 8.2 but I kept getting errors that I couldn't figure out how to fix so your milage may vary. I also ran into some issues with annotations, but I think that is out of the scope of original question.

I had to make a few changes to the persistence.xml to make everything work.

  1. The code would only work if the persistence unit name was set to 'org.jbpm.domain' from 'jbpm.unit01'. Make sure you update the annotations in the code in addition to the persistence.xml. This might not be necessary but I was getting deployment issues if I did not update it.
  2. I created a JBoss data source so you need to update the jta-data-source element. I choose to follow the JBoss convention and picked java:jboss/datasources/jbpmDS.
  3. In the properties section of persistence.xml, you need to update the value of the hibernate.dialect property to the dialect of your database. Choose the best match from this listing
  4. Add the following to the list of properties in persistence.xml: <property name="hibernate.hbm2ddl.auto" value="create" /> This will recreate the database whenever the database deploys. You can change the value to from 'create' to 'validate' once the database has been created so it does not drop the tables with your old data on each following redeploy.
  5. The other thing I found frustrating was that the persistence.xml referenced to other XML file: META-INF/Taskorm.xml and META-INF/JBPMorm.xml. It took me a while to find a version that worked. See my comment to this for a link since I do not have enough repuation to post more than 2 links in a single response.
  6. I needed to remove the lines for BAMTaskSummaryImpl and TaskEventImpl from the class listing. I received a ClassDefNotFound on deploy if those lines were not removed.

Those were my major blockers while trying to get the project to run. I hope that helps.

like image 141
Mike Avatar answered Sep 19 '22 12:09

Mike