The second one is by checking the value of one of its variable, cycling the whole list of the instances for a process definition [...] if the list is very long, I can have problems with performance.
If you write a HQL query, you can have the backend database perform the "cycling" for you in a performant manner.
I'd like to have a Map where I can put and get elements by a key.
How does this relate to obtaining a process instance? Please clarify.
In order to use a HQL query, I have to know how jBPM persists the variables of a process instance.
So I could ask instances for a specific business value.
I'll try to have a closer look to documentation.
For the idea of a Map...
When I ask for the process instances with the last version of a process definition, now there is a method that returns a List.
Creating a new process instance, it could be possible pass an Object as a key of the instance itself.
So when I ask for the istances, I could have a Map and get the correct instance with the key I passed before.
I don't know if there's a simple solution to do this.
I'm only beginning to approach jBMP...