[jboss-user] [JBoss jBPM] - Copy a ProcessDefinition from one Database to another

eddie_84 do-not-reply at jboss.com
Tue Dec 4 02:24:01 EST 2007

In our project we use several different databases to store ProcessDefinitions, and we are now looking for a way to load a ProcessDefinition from database A and store it in database B. We first tried to simply pass it like this:

  | // get the target jbpm context
  | JbpmContext j = getTargetJbpmContext();
  | // load process definitions
  | processDefinitions = getJbpmContext().getGraphSession().findLatestProcessDefinitions();
  | processMap = new HashMap();
  | // deploy process definitions
  | for(Iterator iter = processDefinitions.iterator(); iter.hasNext();){
  |      ProcessDefinition pd = (ProcessDefinition)iter.next();
  |      j.deployProcessDefinition(pd);
  | }

This does not work because hibernate throws this:
org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions

We also tried to serialize and deserialize the object and load the deserialized object in the db, but due to hibernates internal way to store objects on a database this also does not really work, because it inserts a child before a parent what results in a db error because of the RI. This would be avoidable by running the RI-Check only at commit, but that would affect in several dependencies so we couldn't change that.

We also tried to clone the object using the SerializationHelper class, but due to hibernates lazy loading this didn't clone the hole object because not everything was loaded. 

We also couldn't use the xml-description of the processDefinition and parse it again, because if we have to keep them we have a lot of redundant data.

so is there a way to copy a processDefinition from one database to another?

thanks in advance

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110084#4110084

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110084

More information about the jboss-user mailing list