AnsweredAssumed Answered

Create JPA entity in service task

Question asked by chris.joelly on Aug 19, 2011
Latest reply on Aug 31, 2011 by chris.joelly
Hello,

is it possible to create an entity using JPA within an service task and store it as
process variable and use it in other service tasks? I have instantiated a @Entity
in an service task and stored it as process variable. The second service task
then is not able to retrieve that entity, nor is the entity persisted in the database:


Caused by: org.activiti.engine.ActivitiException: Entity does not exist: erp.model.test.TestErp - 801
   at org.activiti.engine.impl.variable.JPAEntityMappings.findEntity(JPAEntityMappings.java:130)
   at org.activiti.engine.impl.variable.JPAEntityMappings.getJPAEntity(JPAEntityMappings.java:119)
   at org.activiti.engine.impl.variable.JPAEntityVariableType.getValue(JPAEntityVariableType.java:77)
   at org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.getValue(VariableInstanceEntity.java:158)
   at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.getVariable(VariableScopeImpl.java:93)
   at erp.domain.activiti.tasks.service.SecondTask.execute(SecondTask.java:29)

and when i create the entity with an EJB which i lookup via JNDI in the service task then the
entity is created in the database and i can store it as process variable. But changes to that
process variable in service tasks are not synchronized to the database. The entity is only
available as process variable.

How can i get it synchronized so that the database and the EJB and the service tasks see the
same entity?

Thanks,

Chris

Outcomes