cancel
Showing results for 
Search instead for 
Did you mean: 

Extending Domain Entities

edufrazao
Champ on-the-rise
Champ on-the-rise
Hi folks. Its possible to extend domain Entities, to bring more information?
I mean, I have some external data connected to my entitites, like Attachments, and other information that is in my Domain Model, but directly connected with ProcessInstances or Tasks. How can I extend this entities to not loose their mapping logic, and provide logic to fill my specific data?

Something like:

interface MyHistoricProcessInstance extends HistoricProcessInstance

2 REPLIES 2

pmsevestre
Champ in-the-making
Champ in-the-making
If you´re using the REST interface there is an extension point that allows you to customize/enrich the entities that are returned to the caller. I´d avoid messing with Ativiti´s tables in order to avoid too much coupling with the its domain model. I think a better approach is to keep in your entities a reference to the relevant Activiti entity (eg, a processInstanceId). If you choose to keep your tables on the same DB, you can even make those references use FKs, so you´ll have strong integrity.

Hi @pmsevestre, thank you for yor answer!
This is what I'm doing. I have another tables where I store Instance ids or Task ids. The problem that i'm facing is how to join this data with Activiti entities, in a single query.
I mean, I want to do a native query, that brings more information than a HistoricProcessInstance can represent. In such case, i can't use use a Native Query for example.

As a real example, look at this table:
[img]http://i.imgur.com/qk3Dg6u.png[/img]

This is records represents active process instances. The column "Descrição" is dynamically generated and update during process execution, and is stored in another table (in my application domain tables). The column "Anexo" represents the existence of attachments in this process, and this can be represented with a simple count query as column. To do that, I need to fetch the process instances, and latter, fetch all this data per row to represent. If I can do that in a single query exteding the activiti domain model to reuse the entity mapping, will be great.
Or maybe, I'm in the wrong path, and the better way is to acess the activiti tables directly with Raw JDBC, or even map activiti tables with my JPA Entities, not allowing changes to it.

What do you think?