问题
We are trying to use Activiti in a new project. I've created a setup which uses Hibernate through JPA for persisting entities involved in the process and JPA is interconnected with Activiti so we can use these entities as JPA variables. See: JPA chapter of Activiti's documentation
I've found out that Activiti doesn't allow me to create queries on processes which involves JPA variables where i like to filter on the JPA entity fields. For example if i have processes with a variable referencing Book entities i can't create a query for processes which have a book with a specific title.
What's the best method to overcome this? I though about querying the entities seperately with Hibernate then do a second query on Activiti to get the processes involved however i'm affraid it will be slow. Also if i'm doing it the other way around (querying the processes first then do a second query with Hibernate on the entities) Activiti does an unnecessarry fill of the JPA variables and i couldn't find out how to get only the entity ID which saved into the Activiti variables table of my database.
回答1:
what about using your entity's ID as businessKey of your process?
You could then do a query on your entities (Books with specific titles) and then use that to retrieve you processes in Activiti
回答2:
I've implemented my solution descirbed in the questions comments. I don't yet have a big dataset to test performance but it seems acceptable.
来源:https://stackoverflow.com/questions/13363739/complex-activiti-jpa-queries