[jBPM Users] - [JBPM 4] Process variable
by czujnik
=== Environment ==============================
- jBPM Version : 4
- Database : Oracle 10g XE
- JDK : 1.5
- Container : standalone App
- Configuration : standard JBPM 4, changed jbpm.hibernate.cfg.xml, added line for Hibernate entity mapping class:
<mapping resource="pl/test/jbpm/entity/Persisted.hbm.xml" />
=== Process ==================================
Process from example: Comments
=== API ===================================
ExecutionService executionService = procEngine.getExecutionService();
Map<String, Object> variables = new HashMap<String, Object>();
Persisted p = new Persisted();
p.setName("Variable");
p.setValue("Value");
SessionFactory sf = procEngine.get(SessionFactory.class);
Session sess = sf.openSession();
sess.beginTransaction();
sess.save(p);
sess.flush();
sess.getTransaction().commit();
variables.put("content", "java");
ProcessInstance processInstance = executionService.startProcessInstanceByKey("TaskVariables", variables);
executionService.setVariable(processInstance.getId(), "persistence", p);
=== Stacktrace ==============================
Exception in thread "main" org.hibernate.HibernateException: instance not of expected entity type: org.jbpm.pvm.internal.type.variable.UnpersistableVariable is not a: org.jbpm.pvm.internal.type.Variable
at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:3663)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1374)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:203)
at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:535)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:103)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:534)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:526)
at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:241)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:291)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:239)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:192)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:319)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:265)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:242)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:192)
at org.hibernate.engine.Cascade.cascade(Cascade.java:153)
at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:154)
at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:145)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:88)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:49)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.jbpm.pvm.internal.tx.HibernateSessionResource.prepare(HibernateSessionResource.java:54)
at org.jbpm.pvm.internal.tx.StandardTransaction.commit(StandardTransaction.java:106)
at org.jbpm.pvm.internal.tx.StandardTransaction.complete(StandardTransaction.java:65)
at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:61)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.setVariable(ExecutionServiceImpl.java:145)
at pl.test.jbpm.Main.main(Main.java:63)
=== Debug logs ==============================
[ScopeInstanceImpl] create variable 'persistence-id' in 'execution[TaskVariables.342]' with value 'pl.test.jbpm.entity.Persisted@970c0e'
=== Problem description =========================
Persistent is a hibernate entity class (configured using XML). The problem is when i'm trying to set hibernate entity as process variable i got exception as above :(
I have no problem to store simple variable as String or Long or even as Serializable class, but for my application i have to store variable as whole entity (in table in DB).
Can You help me with my problem? Did i missed some configuration? Maybe anyone can point complete example of store process variable in DB table ?
Thanks
Czujnik
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4261503#4261503
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4261503
16 years, 5 months
[jBPM Users] - JpdlProcessDefinition cannot be cast to java.util.List
by remiel512
=== Environment ==============================
- jBPM Version : 4.1
- Database : oracle
- JDK : 1.6
- Container : which Java version are you using? use 'java -version' to find out
- Configuration : no
- Libraries : no
=== Process ==================================
none
=== API ===================================
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(historyService.createHistoryProcessInstanceQuery().processInstanceId(pid).uniqueResult().getProcessDefinitionId()).uniqueResult();
=== Stacktrace ==============================
java.lang.ClassCastException: org.jbpm.jpdl.internal.model.JpdlProcessDefinition cannot be cast to java.util.List
| org.jbpm.pvm.internal.repository.ProcessDeployer.deploy(ProcessDeployer.java:64)
| org.jbpm.pvm.internal.repository.DeployerManager.deploy(DeployerManager.java:46)
| org.jbpm.pvm.internal.repository.RepositorySessionImpl.getObject(RepositorySessionImpl.java:120)
| org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.execute(ProcessDefinitionQueryImpl.java:72)
| org.jbpm.pvm.internal.query.AbstractQuery.execute(AbstractQuery.java:81)
| org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
| org.jbpm.pvm.internal.tx.jta.JtaTransactionInterceptor.executeInNewTx(JtaTransactionInterceptor.java:79)
| org.jbpm.pvm.internal.tx.jta.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:61)
| org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
| org.jbpm.pvm.internal.tx.jta.JtaRetryInterceptor.executeWithRetry(JtaRetryInterceptor.java:52)
| org.jbpm.pvm.internal.tx.jta.JtaRetryInterceptor.execute(JtaRetryInterceptor.java:45)
| org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:46)
| org.jbpm.pvm.internal.query.AbstractQuery.untypedList(AbstractQuery.java:62)
| org.jbpm.pvm.internal.query.AbstractQuery.untypedUniqueResult(AbstractQuery.java:69)
| org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl.uniqueResult(ProcessDefinitionQueryImpl.java:145)
| com.gaia.jbpm.core.ProcessManager.getProcessDefinitionByProcessInstanceId(ProcessManager.java:398)
| com.gaia.jbpm.core.ProcessManager.getActivityCoordinatesInfo(ProcessManager.java:349)
| com.gaia.jbpm.action.GetActiveNodeInfo.execute(GetActiveNodeInfo.java:66)
| com.gaia.dispatcher.ActionDispatcher.process(ActionDispatcher.java:35)
| com.sol2.web.dispatcher.SOL2_ActionDispatcher.processRequest(SOL2_ActionDispatcher.java:69)
| com.sol2.web.dispatcher.SOL2_ActionDispatcher.doGet(SOL2_ActionDispatcher.java:52)
| javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
| javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
| com.gaia.filter.ActionFilter.doFilter(ActionFilter.java:129)
| org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
=== Debug logs ==============================
past debug logs here
=== Problem description =========================
Please help me to find out what's the metter of my app. Thanks all.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4261418#4261418
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4261418
16 years, 5 months