持久化VariableInstance 报错

报错:

2010-03-10 17:37:52,953ERROR GraphElement.executeAction(270)-action threw exception: instance not of expected entity type: org.jbpm.context.exe.variableinstance.UnpersistableInstance is not a: org.jbpm.context.exe.VariableInstance
org.hibernate.HibernateException: instance not of expected entity type: org.jbpm.context.exe.variableinstance.UnpersistableInstance is not a: org.jbpm.context.exe.VariableInstance
at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:3583)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1347)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)
at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:487)

2010-03-10 17:37:52,984ERROR LazyInitializationException.<init>(19)-failed to lazily initialize a collection of role: org.jbpm.graph.def.Node.exceptionHandlers, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: org.jbpm.graph.def.Node.exceptionHandlers, no session or session was closed
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
at org.hibernate.collection.PersistentList.iterator(PersistentList.java:115)

 

问题解决了,这个问题是由于jbpm变量引起的。
在jbpm3.2版本中,它将所有的变量是要入库的,上面的错误是由于在这些变量中存在没有序列化的,不是数据类型不是基础类型。
解决方法:当不需要入库的内容用瞬时变量(setTransientVariable)来定义,原先我用的是setVariable(),这样这个变量只在流程流转过程中有效,不入库,自然就不会报错了。

你可能感兴趣的:(持久化VariableInstance 报错)