cancel
Showing results for 
Search instead for 
Did you mean: 

JPA variable must pre-exist?

tstephen
Champ on-the-rise
Champ on-the-rise
Hi,

I'm just exploring the JPA variable support and have a question on the expected usage. The example test case JPAVariableTest creates all the entities to be manipulated prior to running the process engine. When I pass in a new (unpersisted) entity I receive an ActivitiException with message 'Entity does not exist…' Is it a requirement that the entity already exist and the process engine merely update it? Ideally I want the process engine to create the entity in response to the initial process instance creation.

cheers,
Tim
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
The entity should already be persisted when activiti want's to use it (activiti has no knowledge of your app, it only uses the entityManeger passed to retreive the entities by ID).
You should make sure the entities you want to use are persisted, you can do this eg. in an execution-listener on process-start or something simmilar (taskListener, serviceTask, …).