The best practise to bind JPA-Entity to process

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2016 06:39 AM
Hi,
I would like to ask you, what is the best way of binding a JPA-Entity to activiti process?
I tried to set bean as a process variable:
But this solition has a big drawback. I store the same data in two different places. One is table generated by my entityManager, and second is serialized object variable in activiti DB. The other problem is with querying by fields of my bean, I believe it is so complicated because there is always need to deserialize a bean before checking values of fields.
Is it possible to store in a process only a reference to my bean ? I could do it by hand by define some map wiring task id with my bean id. Maybe there is some mechanism out of box which do this work?
Best Regards.
I would like to ask you, what is the best way of binding a JPA-Entity to activiti process?
I tried to set bean as a process variable:
variables.put("myBean", myBean);runtimeService.startProcessInstanceByKey("myProcess", variables);
But this solition has a big drawback. I store the same data in two different places. One is table generated by my entityManager, and second is serialized object variable in activiti DB. The other problem is with querying by fields of my bean, I believe it is so complicated because there is always need to deserialize a bean before checking values of fields.
Is it possible to store in a process only a reference to my bean ? I could do it by hand by define some map wiring task id with my bean id. Maybe there is some mechanism out of box which do this work?
Best Regards.
Labels:
- Labels:
-
Archive
4 REPLIES 4

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2016 08:28 AM
Is it a good idea to store in process variables only jpa-entity object id?
<java>
variables.put("myBeanID", myBean.getId());
runtimeService.startProcessInstanceByKey("myProcess", variables);
</java>
Regards
<java>
variables.put("myBeanID", myBean.getId());
runtimeService.startProcessInstanceByKey("myProcess", variables);
</java>
Regards
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2016 06:02 AM
> Is it possible to store in a process only a reference to my bean ?
Activiti has out of the box JPA integration, solving exactly this problem: http://activiti.org/userguide/index.html#_jpa
Activiti has out of the box JPA integration, solving exactly this problem: http://activiti.org/userguide/index.html#_jpa

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2016 09:55 AM
Joram,
I'm interested in learning more on Activiti/JPA integration. Our business entity layer is Cassandra and not JPA-enabled, but understanding the semantics might allow us to replicate similar behavior.
For instance, what classes/methods does Activiti add the hooks to autostore and autoload (e.g. if the process var is annotated as a JPA entity, go load it from the EntityManager when the process variable is loaded)?
Jason
I'm interested in learning more on Activiti/JPA integration. Our business entity layer is Cassandra and not JPA-enabled, but understanding the semantics might allow us to replicate similar behavior.
For instance, what classes/methods does Activiti add the hooks to autostore and autoload (e.g. if the process var is annotated as a JPA entity, go load it from the EntityManager when the process variable is loaded)?
Jason
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2016 12:08 PM
Check following classes to get an idea:
https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/...
https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/...
https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/...
https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/...
https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/...
https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/...
https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/...
https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/...
