In 3.2 a businesskey can be added to the processinstance. So you can do it both ways. Add add the processinstance id (and maybe tokens if there is some forking) as a fk to your domain model or the other way around. Both work. I would only add a status to the domain if it is independent of the processes. e.g. getting a mortgage is a process (status: under request). Having one isn't (status: assigned(?), changing it is (status: choose one...) ;-))
I checked the code and saw the key you're refering to :
public ProcessInstance loadProcessInstance(ProcessDefinition processDefinition, String key);
So, if I remove the status from the domain, and use that business key attribute to materialize the link between domain and process instance, what would be the elegant way of searching all the ITEMs in 'toBeValidated' Status (ie Node) ? :
Call a custom query on Jbpm, get the matching nodes and use the associated business keys to load the corresponding domain entities ?
I see that the API is rather Task oriented so I wonder if that would be a hint to another way of thinking this workflow integration.
Thanks for you advices,
Any realworld experience with modeling and exploiting a domain entity' status as token's current state ? (including search/agregation, joining to the model and performance issues...) any feedback would be apreciated.