cancel
Showing results for 
Search instead for 
Did you mean: 

Separate business data and process relative data

beep02
Champ in-the-making
Champ in-the-making
I tried to understand how activiti works with data.
I searched and read several forum posts, so I came prepared to ask question.
What I currently understand is following:

1.
Activity hides persistence layer and works with Variables, which , if defined as JPA entities, could be automatically fetched from entity manager and updated in entity manager.
-are they remain in database, when instance of the process completed it's work?
-can we also add (insert) and remove (delete) entities?

2.
If I want add to the variables approach, e.g. I write a Java Service Task, that access the entity manager
- can I use the same transaction, that the engine manages? 
- can I create a separate transaction, that is not the part of the Engine transaction?

3.
Can I use Hibernate as JPA implementation?

4.
I need an approach to allow Activiti work as much natural for Activiti as possible.
At the same time I need work with complex data model, that has not had Activity in mind.
During the activity task, I must change/evaluate objects in DB, such objects, that not easily integrated in JPA model or in activiti model.

What would you do, if you were required to work with business data beyond the scope of variables?
Especially, if your data model is not initially built with Activiti in mind.

Thanks.

3 REPLIES 3

beep02
Champ in-the-making
Champ in-the-making
I succeed to integrate with Hibernate (Jpa of course), and this my tutorial:
http://serverbabyblog.wordpress.com/2014/03/20/activiti-jpa-integration-using-hibernate/

But I found, that conceptually, when you develop with activiti or with Jbpm , you need realize, what you really want in your design:
1) change business objects as a part of a process transaction
(and then presumably, have these objects tightly coupled with the way activiti operates, e.g. you obliged choose JPA or MyBatis as a way you connect the app to the database )

2) change your business objects in separate transaction, may be in separate connection, may be in separate data base…
And then you have a freedom of ORM approach , but you need your own ways to rollback the change, if this rollback required by the virtue of the business process.

For me it looks a sort of a hard choice..

ollib
Champ in-the-making
Champ in-the-making
I have a similar problem, see http://forums.activiti.org/content/example-spring-configuration-transactionmanager-required

I'm sure that operations on business data and Activiti data could run in the same transaction, perhaps with JTA. I hope there will be a solution soon.

jbarrez
Star Contributor
Star Contributor
beep02: correct that is the tradeoff. I always found it a best practice to have it a separate from Activiti. Activiti should't be the master of your data.  but indeed, it comes with the price of custom rollback, unless you can hook it up with some JTA enabled datasource.