=== 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.persis...@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 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user