2 Replies Latest reply on Nov 15, 2007 3:16 AM by Sujith Babu

    jbpm db upgrade from 2.0 to 3.2

    Sujith Babu Newbie

      I am a complete newbee to JBPM. I need to migrate data in database from version JBPM2.0 to JBPM3.2 (or at least 3.0). Is there any script etc that does this. Can anyone give pointers to this.
      Thanks

        • 1. Re: jbpm db upgrade from 2.0 to 3.2
          Ronald van Kuijk Master

          no, there is no migrationscript from 2.0 to 3.0/x. From 3.0 on this has gotten high priority, so migrationscripts from 3.0 to 3.1 to 3.2 are available

          • 2. Re: jbpm db upgrade from 2.0 to 3.2
            Sujith Babu Newbie

            Thanks a lot for this.

            Somebody else must have tried this earlier. Can anyone give me some tips on some workaround. The purpose is to migrate data in database from 2.0 to 3.X .

            I did some further reading and this is what I found.
            ****************************************************************
            Update the properties in the build.properties in the root of the jbpm.db project:
            upgrade.hibernate.properties: a properties file that contains the connection properties to your database in hibernate style.
            upgrade.libdir: the directory containing the jdbc driver jars for your database.
            upgrade.old.schema.script: the schema generation script to create the old database schema. (if it already exists, you don't need this property.)
            For creating the old schema and then calculating the differences, run the ant script 'ant upgrade.db.script'
            For only calculating the update script without first loading the old db schema, run the ant script 'ant upgrade.hibernate.schema.update'
            After successful completion, you'll find the upgrade script in build/database.upgrade.sql
            ****************************************************************

            I was able to generate a migration script after pointing the hibernate properties file against the JBPM2.0 database that I have created. Please find this script pasted. But I am mostly sure that this is not what would achieve our purpose. The script changes the table structure from 2.0 to 3.2, but it does not migrate the data. In fact the script generated is probably such that the database would have the tables and columns required for both versions. (This I need to verify again).

            If I am not wrong, the data in the column named as ID in Version 2.0 tables should now be moved to column ID_ in Version 3.2 tables. But that has not happened in this ant generated script. Logically it should contain some “insert into newTable select XXX, YYY from table2â€� kind of statement. I can’t see a single insert statement to that effect in this script.

            Am I at the right places? Is there any point in putting more effor in this?

            Now the script.
            **************************************************************
            alter table JBPM_ACTION add ID_ numeric(19,0);
            alter table JBPM_ACTION add class char(1);
            alter table JBPM_ACTION add NAME_ varchar(255);
            alter table JBPM_ACTION add ISPROPAGATIONALLOWED_ tinyint;
            alter table JBPM_ACTION add ACTIONEXPRESSION_ varchar(255);
            alter table JBPM_ACTION add ISASYNC_ tinyint;
            alter table JBPM_ACTION add REFERENCEDACTION_ numeric(19,0);
            alter table JBPM_ACTION add ACTIONDELEGATION_ numeric(19,0);
            alter table JBPM_ACTION add EVENT_ numeric(19,0);
            alter table JBPM_ACTION add PROCESSDEFINITION_ numeric(19,0);
            alter table JBPM_ACTION add TIMERNAME_ varchar(255);
            alter table JBPM_ACTION add DUEDATE_ varchar(255);
            alter table JBPM_ACTION add REPEAT_ varchar(255);
            alter table JBPM_ACTION add TRANSITIONNAME_ varchar(255);
            alter table JBPM_ACTION add TIMERACTION_ numeric(19,0);
            alter table JBPM_ACTION add EXPRESSION_ varchar(4000);
            alter table JBPM_ACTION add EVENTINDEX_ int;
            alter table JBPM_ACTION add EXCEPTIONHANDLER_ numeric(19,0);
            alter table JBPM_ACTION add EXCEPTIONHANDLERINDEX_ int;
            create table JBPM_BYTEARRAY (ID_ numeric(19,0) identity not null, NAME_ varchar(255) null, FILEDEFINITION_ numeric(19,0) null, primary key (ID_));
            create table JBPM_BYTEBLOCK (PROCESSFILE_ numeric(19,0) not null, BYTES_ varbinary(1024) null, INDEX_ int not null, primary key (PROCESSFILE_, INDEX_));
            create table JBPM_COMMENT (ID_ numeric(19,0) identity not null, VERSION_ int not null, ACTORID_ varchar(255) null, TIME_ datetime null, MESSAGE_ varchar(4000) null, TOKEN_ numeric(19,0) null, TASKINSTANCE_ numeric(19,0) null, TOKENINDEX_ int null, TASKINSTANCEINDEX_ int null, primary key (ID_));
            create table JBPM_DECISIONCONDITIONS (DECISION_ numeric(19,0) not null, TRANSITIONNAME_ varchar(255) null, EXPRESSION_ varchar(255) null, INDEX_ int not null, primary key (DECISION_, INDEX_));
            alter table JBPM_DELEGATION add ID_ numeric(19,0);
            alter table JBPM_DELEGATION add CLASSNAME_ varchar(4000);
            alter table JBPM_DELEGATION add CONFIGURATION_ varchar(4000);
            alter table JBPM_DELEGATION add CONFIGTYPE_ varchar(255);
            alter table JBPM_DELEGATION add PROCESSDEFINITION_ numeric(19,0);
            create table JBPM_EVENT (ID_ numeric(19,0) identity not null, EVENTTYPE_ varchar(255) null, TYPE_ char(1) null, GRAPHELEMENT_ numeric(19,0) null, PROCESSDEFINITION_ numeric(19,0) null, NODE_ numeric(19,0) null, TRANSITION_ numeric(19,0) null, TASK_ numeric(19,0) null, primary key (ID_));
            create table JBPM_EXCEPTIONHANDLER (ID_ numeric(19,0) identity not null, EXCEPTIONCLASSNAME_ varchar(4000) null, TYPE_ char(1) null, GRAPHELEMENT_ numeric(19,0) null, PROCESSDEFINITION_ numeric(19,0) null, GRAPHELEMENTINDEX_ int null, NODE_ numeric(19,0) null, TRANSITION_ numeric(19,0) null, TASK_ numeric(19,0) null, primary key (ID_));
            create table JBPM_ID_GROUP (ID_ numeric(19,0) identity not null, CLASS_ char(1) not null, NAME_ varchar(255) null, TYPE_ varchar(255) null, PARENT_ numeric(19,0) null, primary key (ID_));
            create table JBPM_ID_MEMBERSHIP (ID_ numeric(19,0) identity not null, CLASS_ char(1) not null, NAME_ varchar(255) null, ROLE_ varchar(255) null, USER_ numeric(19,0) null, GROUP_ numeric(19,0) null, primary key (ID_));
            create table JBPM_ID_PERMISSIONS (ENTITY_ numeric(19,0) not null, CLASS_ varchar(255) null, NAME_ varchar(255) null, ACTION_ varchar(255) null);
            create table JBPM_ID_USER (ID_ numeric(19,0) identity not null, CLASS_ char(1) not null, NAME_ varchar(255) null, EMAIL_ varchar(255) null, PASSWORD_ varchar(255) null, primary key (ID_));
            create table JBPM_LOG (ID_ numeric(19,0) identity not null, CLASS_ char(1) not null, INDEX_ int null, DATE_ datetime null, TOKEN_ numeric(19,0) null, PARENT_ numeric(19,0) null, MESSAGE_ varchar(4000) null, EXCEPTION_ varchar(4000) null, ACTION_ numeric(19,0) null, NODE_ numeric(19,0) null, ENTER_ datetime null, LEAVE_ datetime null, DURATION_ numeric(19,0) null, TRANSITION_ numeric(19,0) null, CHILD_ numeric(19,0) null, SOURCENODE_ numeric(19,0) null, DESTINATIONNODE_ numeric(19,0) null, VARIABLEINSTANCE_ numeric(19,0) null, OLDBYTEARRAY_ numeric(19,0) null, NEWBYTEARRAY_ numeric(19,0) null, OLDDATEVALUE_ datetime null, NEWDATEVALUE_ datetime null, OLDDOUBLEVALUE_ double precision null, NEWDOUBLEVALUE_ double precision null, OLDLONGIDCLASS_ varchar(255) null, OLDLONGIDVALUE_ numeric(19,0) null, NEWLONGIDCLASS_ varchar(255) null, NEWLONGIDVALUE_ numeric(19,0) null, OLDSTRINGIDCLASS_ varchar(255) null, OLDSTRINGIDVALUE_ varchar(255) null, NEWSTRINGIDCLASS_ varchar(255) null, NEWSTRINGIDVALUE_ varchar(255) null, OLDLONGVALUE_ numeric(19,0) null, NEWLONGVALUE_ numeric(19,0) null, OLDSTRINGVALUE_ varchar(4000) null, NEWSTRINGVALUE_ varchar(4000) null, TASKINSTANCE_ numeric(19,0) null, TASKACTORID_ varchar(255) null, TASKOLDACTORID_ varchar(255) null, SWIMLANEINSTANCE_ numeric(19,0) null, primary key (ID_));
            create table JBPM_MESSAGE (ID_ numeric(19,0) identity not null, CLASS_ char(1) not null, DESTINATION_ varchar(255) null, EXCEPTION_ varchar(255) null, ISSUSPENDED_ tinyint null, TOKEN_ numeric(19,0) null, TEXT_ varchar(255) null, ACTION_ numeric(19,0) null, NODE_ numeric(19,0) null, TRANSITIONNAME_ varchar(255) null, TASKINSTANCE_ numeric(19,0) null, primary key (ID_));
            create table JBPM_MODULEDEFINITION (ID_ numeric(19,0) identity not null, CLASS_ char(1) not null, NAME_ varchar(4000) null, PROCESSDEFINITION_ numeric(19,0) null, STARTTASK_ numeric(19,0) null, primary key (ID_));
            create table JBPM_MODULEINSTANCE (ID_ numeric(19,0) identity not null, CLASS_ char(1) not null, PROCESSINSTANCE_ numeric(19,0) null, TASKMGMTDEFINITION_ numeric(19,0) null, NAME_ varchar(255) null, primary key (ID_));
            alter table JBPM_NODE add ID_ numeric(19,0);
            alter table JBPM_NODE add CLASS_ char(1);
            alter table JBPM_NODE add NAME_ varchar(255);
            alter table JBPM_NODE add PROCESSDEFINITION_ numeric(19,0);
            alter table JBPM_NODE add ISASYNC_ tinyint;
            alter table JBPM_NODE add ACTION_ numeric(19,0);
            alter table JBPM_NODE add SUPERSTATE_ numeric(19,0);
            alter table JBPM_NODE add SUBPROCESSDEFINITION_ numeric(19,0);
            alter table JBPM_NODE add DECISIONEXPRESSION_ varchar(255);
            alter table JBPM_NODE add DECISIONDELEGATION numeric(19,0);
            alter table JBPM_NODE add SIGNAL_ int;
            alter table JBPM_NODE add CREATETASKS_ tinyint;
            alter table JBPM_NODE add ENDTASKS_ tinyint;
            alter table JBPM_NODE add NODECOLLECTIONINDEX_ int;
            create table JBPM_POOLEDACTOR (ID_ numeric(19,0) identity not null, ACTORID_ varchar(255) null, SWIMLANEINSTANCE_ numeric(19,0) null, primary key (ID_));
            create table JBPM_PROCESSDEFINITION (ID_ numeric(19,0) identity not null, NAME_ varchar(255) null, VERSION_ int null, ISTERMINATIONIMPLICIT_ tinyint null, STARTSTATE_ numeric(19,0) null, primary key (ID_));
            alter table JBPM_PROCESSINSTANCE add ID_ numeric(19,0);
            alter table JBPM_PROCESSINSTANCE add VERSION_ int;
            alter table JBPM_PROCESSINSTANCE add ISSUSPENDED_ tinyint;
            alter table JBPM_PROCESSINSTANCE add PROCESSDEFINITION_ numeric(19,0);
            alter table JBPM_PROCESSINSTANCE add ROOTTOKEN_ numeric(19,0);
            alter table JBPM_PROCESSINSTANCE add SUPERPROCESSTOKEN_ numeric(19,0);
            create table JBPM_RUNTIMEACTION (ID_ numeric(19,0) identity not null, VERSION_ int not null, EVENTTYPE_ varchar(255) null, TYPE_ char(1) null, GRAPHELEMENT_ numeric(19,0) null, PROCESSINSTANCE_ numeric(19,0) null, ACTION_ numeric(19,0) null, PROCESSINSTANCEINDEX_ int null, primary key (ID_));
            alter table JBPM_SWIMLANE add ID_ numeric(19,0);
            alter table JBPM_SWIMLANE add NAME_ varchar(255);
            alter table JBPM_SWIMLANE add ACTORIDEXPRESSION_ varchar(255);
            alter table JBPM_SWIMLANE add POOLEDACTORSEXPRESSION_ varchar(255);
            alter table JBPM_SWIMLANE add ASSIGNMENTDELEGATION_ numeric(19,0);
            alter table JBPM_SWIMLANE add TASKMGMTDEFINITION_ numeric(19,0);
            create table JBPM_SWIMLANEINSTANCE (ID_ numeric(19,0) identity not null, NAME_ varchar(255) null, ACTORID_ varchar(255) null, SWIMLANE_ numeric(19,0) null, TASKMGMTINSTANCE_ numeric(19,0) null, primary key (ID_));
            create table JBPM_TASK (ID_ numeric(19,0) identity not null, NAME_ varchar(255) null, PROCESSDEFINITION_ numeric(19,0) null, DESCRIPTION_ varchar(4000) null, ISBLOCKING_ tinyint null, ISSIGNALLING_ tinyint null, DUEDATE_ varchar(255) null, ACTORIDEXPRESSION_ varchar(255) null, POOLEDACTORSEXPRESSION_ varchar(255) null, TASKMGMTDEFINITION_ numeric(19,0) null, TASKNODE_ numeric(19,0) null, STARTSTATE_ numeric(19,0) null, ASSIGNMENTDELEGATION_ numeric(19,0) null, SWIMLANE_ numeric(19,0) null, TASKCONTROLLER_ numeric(19,0) null, primary key (ID_));
            create table JBPM_TASKACTORPOOL (TASKINSTANCE_ numeric(19,0) not null, POOLEDACTOR_ numeric(19,0) not null, primary key (TASKINSTANCE_, POOLEDACTOR_));
            create table JBPM_TASKCONTROLLER (ID_ numeric(19,0) identity not null, TASKCONTROLLERDELEGATION_ numeric(19,0) null, primary key (ID_));
            create table JBPM_TASKINSTANCE (ID_ numeric(19,0) identity not null, CLASS_ char(1) not null, NAME_ varchar(255) null, DESCRIPTION_ varchar(4000) null, ACTORID_ varchar(255) null, CREATE_ datetime null, START_ datetime null, END_ datetime null, DUEDATE_ datetime null, PRIORITY_ int null, ISCANCELLED_ tinyint null, ISSUSPENDED_ tinyint null, ISOPEN_ tinyint null, ISSIGNALLING_ tinyint null, ISBLOCKING_ tinyint null, TASK_ numeric(19,0) null, TOKEN_ numeric(19,0) null, SWIMLANINSTANCE_ numeric(19,0) null, TASKMGMTINSTANCE_ numeric(19,0) null, primary key (ID_));
            create table JBPM_TIMER (ID_ numeric(19,0) identity not null, NAME_ varchar(255) null, DUEDATE_ datetime null, REPEAT_ varchar(255) null, TRANSITIONNAME_ varchar(255) null, EXCEPTION_ varchar(4000) null, ISSUSPENDED_ tinyint null, ACTION_ numeric(19,0) null, TOKEN_ numeric(19,0) null, PROCESSINSTANCE_ numeric(19,0) null, TASKINSTANCE_ numeric(19,0) null, GRAPHELEMENTTYPE_ varchar(255) null, GRAPHELEMENT_ numeric(19,0) null, primary key (ID_));
            alter table JBPM_TOKEN add ID_ numeric(19,0);
            alter table JBPM_TOKEN add VERSION_ int;
            alter table JBPM_TOKEN add NAME_ varchar(255);
            alter table JBPM_TOKEN add NODEENTER_ datetime;
            alter table JBPM_TOKEN add NEXTLOGINDEX_ int;
            alter table JBPM_TOKEN add ISABLETOREACTIVATEPARENT_ tinyint;
            alter table JBPM_TOKEN add ISTERMINATIONIMPLICIT_ tinyint;
            alter table JBPM_TOKEN add ISSUSPENDED_ tinyint;
            alter table JBPM_TOKEN add NODE_ numeric(19,0);
            alter table JBPM_TOKEN add PROCESSINSTANCE_ numeric(19,0);
            alter table JBPM_TOKEN add PARENT_ numeric(19,0);
            alter table JBPM_TOKEN add SUBPROCESSINSTANCE_ numeric(19,0);
            create table JBPM_TOKENVARIABLEMAP (ID_ numeric(19,0) identity not null, TOKEN_ numeric(19,0) null, CONTEXTINSTANCE_ numeric(19,0) null, primary key (ID_));
            alter table JBPM_TRANSITION add ID_ numeric(19,0);
            alter table JBPM_TRANSITION add NAME_ varchar(255);
            alter table JBPM_TRANSITION add PROCESSDEFINITION_ numeric(19,0);
            alter table JBPM_TRANSITION add FROMINDEX_ int;
            create table JBPM_VARIABLEACCESS (ID_ numeric(19,0) identity not null, VARIABLENAME_ varchar(255) null, ACCESS_ varchar(255) null, MAPPEDNAME_ varchar(255) null, PROCESSSTATE_ numeric(19,0) null, TASKCONTROLLER_ numeric(19,0) null, INDEX_ int null, SCRIPT_ numeric(19,0) null, primary key (ID_));
            alter table JBPM_VARIABLEINSTANCE add ID_ numeric(19,0);
            alter table JBPM_VARIABLEINSTANCE add CLASS_ char(1);
            alter table JBPM_VARIABLEINSTANCE add NAME_ varchar(255);
            alter table JBPM_VARIABLEINSTANCE add CONVERTER_ char(1);
            alter table JBPM_VARIABLEINSTANCE add TOKEN_ numeric(19,0);
            alter table JBPM_VARIABLEINSTANCE add TOKENVARIABLEMAP_ numeric(19,0);
            alter table JBPM_VARIABLEINSTANCE add PROCESSINSTANCE_ numeric(19,0);
            alter table JBPM_VARIABLEINSTANCE add BYTEARRAYVALUE_ numeric(19,0);
            alter table JBPM_VARIABLEINSTANCE add DATEVALUE_ datetime;
            alter table JBPM_VARIABLEINSTANCE add DOUBLEVALUE_ double precision;
            alter table JBPM_VARIABLEINSTANCE add LONGIDCLASS_ varchar(255);
            alter table JBPM_VARIABLEINSTANCE add LONGVALUE_ numeric(19,0);
            alter table JBPM_VARIABLEINSTANCE add STRINGIDCLASS_ varchar(255);
            alter table JBPM_VARIABLEINSTANCE add STRINGVALUE_ varchar(255);
            alter table JBPM_VARIABLEINSTANCE add TASKINSTANCE_ numeric(19,0);
            alter table JBPM_ACTION add constraint FK_ACTION_EVENT foreign key (EVENT_) references JBPM_EVENT;
            alter table JBPM_ACTION add constraint FK_ACTION_EXPTHDL foreign key (EXCEPTIONHANDLER_) references JBPM_EXCEPTIONHANDLER;
            alter table JBPM_ACTION add constraint FK_ACTION_PROCDEF foreign key (PROCESSDEFINITION_) references JBPM_PROCESSDEFINITION;
            alter table JBPM_ACTION add constraint FK_CRTETIMERACT_TA foreign key (TIMERACTION_) references JBPM_ACTION;
            alter table JBPM_ACTION add constraint FK_ACTION_ACTNDEL foreign key (ACTIONDELEGATION_) references JBPM_DELEGATION;
            alter table JBPM_ACTION add constraint FK_ACTION_REFACT foreign key (REFERENCEDACTION_) references JBPM_ACTION;
            alter table JBPM_BYTEARRAY add constraint FK_BYTEARR_FILDEF foreign key (FILEDEFINITION_) references JBPM_MODULEDEFINITION;
            alter table JBPM_BYTEBLOCK add constraint FK_BYTEBLOCK_FILE foreign key (PROCESSFILE_) references JBPM_BYTEARRAY;
            alter table JBPM_COMMENT add constraint FK_COMMENT_TOKEN foreign key (TOKEN_) references JBPM_TOKEN;
            alter table JBPM_COMMENT add constraint FK_COMMENT_TSK foreign key (TASKINSTANCE_) references JBPM_TASKINSTANCE;
            alter table JBPM_DECISIONCONDITIONS add constraint FK_DECCOND_DEC foreign key (DECISION_) references JBPM_NODE;
            alter table JBPM_DELEGATION add constraint FK_DELEGATION_PRCD foreign key (PROCESSDEFINITION_) references JBPM_PROCESSDEFINITION;
            alter table JBPM_EVENT add constraint FK_EVENT_PROCDEF foreign key (PROCESSDEFINITION_) references JBPM_PROCESSDEFINITION;
            alter table JBPM_EVENT add constraint FK_EVENT_NODE foreign key (NODE_) references JBPM_NODE;
            alter table JBPM_EVENT add constraint FK_EVENT_TRANS foreign key (TRANSITION_) references JBPM_TRANSITION;
            alter table JBPM_EVENT add constraint FK_EVENT_TASK foreign key (TASK_) references JBPM_TASK;
            alter table JBPM_ID_GROUP add constraint FK_ID_GRP_PARENT foreign key (PARENT_) references JBPM_ID_GROUP;
            alter table JBPM_ID_MEMBERSHIP add constraint FK_ID_MEMSHIP_GRP foreign key (GROUP_) references JBPM_ID_GROUP;
            alter table JBPM_ID_MEMBERSHIP add constraint FK_ID_MEMSHIP_USR foreign key (USER_) references JBPM_ID_USER;
            alter table JBPM_LOG add constraint FK_LOG_SOURCENODE foreign key (SOURCENODE_) references JBPM_NODE;
            alter table JBPM_LOG add constraint FK_LOG_TOKEN foreign key (TOKEN_) references JBPM_TOKEN;
            alter table JBPM_LOG add constraint FK_LOG_OLDBYTES foreign key (OLDBYTEARRAY_) references JBPM_BYTEARRAY;
            alter table JBPM_LOG add constraint FK_LOG_NEWBYTES foreign key (NEWBYTEARRAY_) references JBPM_BYTEARRAY;
            alter table JBPM_LOG add constraint FK_LOG_CHILDTOKEN foreign key (CHILD_) references JBPM_TOKEN;
            alter table JBPM_LOG add constraint FK_LOG_DESTNODE foreign key (DESTINATIONNODE_) references JBPM_NODE;
            alter table JBPM_LOG add constraint FK_LOG_TASKINST foreign key (TASKINSTANCE_) references JBPM_TASKINSTANCE;
            alter table JBPM_LOG add constraint FK_LOG_SWIMINST foreign key (SWIMLANEINSTANCE_) references JBPM_SWIMLANEINSTANCE;
            alter table JBPM_LOG add constraint FK_LOG_PARENT foreign key (PARENT_) references JBPM_LOG;
            alter table JBPM_LOG add constraint FK_LOG_NODE foreign key (NODE_) references JBPM_NODE;
            alter table JBPM_LOG add constraint FK_LOG_ACTION foreign key (ACTION_) references JBPM_ACTION;
            alter table JBPM_LOG add constraint FK_LOG_VARINST foreign key (VARIABLEINSTANCE_) references JBPM_VARIABLEINSTANCE;
            alter table JBPM_LOG add constraint FK_LOG_TRANSITION foreign key (TRANSITION_) references JBPM_TRANSITION;
            alter table JBPM_MESSAGE add constraint FK_MSG_TOKEN foreign key (TOKEN_) references JBPM_TOKEN;
            alter table JBPM_MESSAGE add constraint FK_CMD_NODE foreign key (NODE_) references JBPM_NODE;
            alter table JBPM_MESSAGE add constraint FK_CMD_ACTION foreign key (ACTION_) references JBPM_ACTION;
            alter table JBPM_MESSAGE add constraint FK_CMD_TASKINST foreign key (TASKINSTANCE_) references JBPM_TASKINSTANCE;
            alter table JBPM_MODULEDEFINITION add constraint FK_TSKDEF_START foreign key (STARTTASK_) references JBPM_TASK;
            alter table JBPM_MODULEDEFINITION add constraint FK_MODDEF_PROCDEF foreign key (PROCESSDEFINITION_) references JBPM_PROCESSDEFINITION;
            alter table JBPM_MODULEINSTANCE add constraint FK_TASKMGTINST_TMD foreign key (TASKMGMTDEFINITION_) references JBPM_MODULEDEFINITION;
            alter table JBPM_MODULEINSTANCE add constraint FK_MODINST_PRCINST foreign key (PROCESSINSTANCE_) references JBPM_PROCESSINSTANCE;
            alter table JBPM_NODE add constraint FK_PROCST_SBPRCDEF foreign key (SUBPROCESSDEFINITION_) references JBPM_PROCESSDEFINITION;
            alter table JBPM_NODE add constraint FK_NODE_PROCDEF foreign key (PROCESSDEFINITION_) references JBPM_PROCESSDEFINITION;
            alter table JBPM_NODE add constraint FK_NODE_ACTION foreign key (ACTION_) references JBPM_ACTION;
            alter table JBPM_NODE add constraint FK_DECISION_DELEG foreign key (DECISIONDELEGATION) references JBPM_DELEGATION;
            alter table JBPM_NODE add constraint FK_NODE_SUPERSTATE foreign key (SUPERSTATE_) references JBPM_NODE;
            alter table JBPM_POOLEDACTOR add constraint FK_POOLEDACTOR_SLI foreign key (SWIMLANEINSTANCE_) references JBPM_SWIMLANEINSTANCE;
            alter table JBPM_PROCESSDEFINITION add constraint FK_PROCDEF_STRTSTA foreign key (STARTSTATE_) references JBPM_NODE;
            alter table JBPM_PROCESSINSTANCE add constraint FK_PROCIN_PROCDEF foreign key (PROCESSDEFINITION_) references JBPM_PROCESSDEFINITION;
            alter table JBPM_PROCESSINSTANCE add constraint FK_PROCIN_ROOTTKN foreign key (ROOTTOKEN_) references JBPM_TOKEN;
            alter table JBPM_PROCESSINSTANCE add constraint FK_PROCIN_SPROCTKN foreign key (SUPERPROCESSTOKEN_) references JBPM_TOKEN;
            alter table JBPM_RUNTIMEACTION add constraint FK_RTACTN_PROCINST foreign key (PROCESSINSTANCE_) references JBPM_PROCESSINSTANCE;
            alter table JBPM_RUNTIMEACTION add constraint FK_RTACTN_ACTION foreign key (ACTION_) references JBPM_ACTION;
            alter table JBPM_SWIMLANE add constraint FK_SWL_ASSDEL foreign key (ASSIGNMENTDELEGATION_) references JBPM_DELEGATION;
            alter table JBPM_SWIMLANE add constraint FK_SWL_TSKMGMTDEF foreign key (TASKMGMTDEFINITION_) references JBPM_MODULEDEFINITION;
            alter table JBPM_SWIMLANEINSTANCE add constraint FK_SWIMLANEINST_TM foreign key (TASKMGMTINSTANCE_) references JBPM_MODULEINSTANCE;
            alter table JBPM_SWIMLANEINSTANCE add constraint FK_SWIMLANEINST_SL foreign key (SWIMLANE_) references JBPM_SWIMLANE;
            alter table JBPM_TASK add constraint FK_TSK_TSKCTRL foreign key (TASKCONTROLLER_) references JBPM_TASKCONTROLLER;
            alter table JBPM_TASK add constraint FK_TASK_ASSDEL foreign key (ASSIGNMENTDELEGATION_) references JBPM_DELEGATION;
            alter table JBPM_TASK add constraint FK_TASK_TASKNODE foreign key (TASKNODE_) references JBPM_NODE;
            alter table JBPM_TASK add constraint FK_TASK_PROCDEF foreign key (PROCESSDEFINITION_) references JBPM_PROCESSDEFINITION;
            alter table JBPM_TASK add constraint FK_TASK_STARTST foreign key (STARTSTATE_) references JBPM_NODE;
            alter table JBPM_TASK add constraint FK_TASK_TASKMGTDEF foreign key (TASKMGMTDEFINITION_) references JBPM_MODULEDEFINITION;
            alter table JBPM_TASK add constraint FK_TASK_SWIMLANE foreign key (SWIMLANE_) references JBPM_SWIMLANE;
            alter table JBPM_TASKACTORPOOL add constraint FK_TSKACTPOL_PLACT foreign key (POOLEDACTOR_) references JBPM_POOLEDACTOR;
            alter table JBPM_TASKACTORPOOL add constraint FK_TASKACTPL_TSKI foreign key (TASKINSTANCE_) references JBPM_TASKINSTANCE;
            alter table JBPM_TASKCONTROLLER add constraint FK_TSKCTRL_DELEG foreign key (TASKCONTROLLERDELEGATION_) references JBPM_DELEGATION;
            alter table JBPM_TASKINSTANCE add constraint FK_TASKINST_TMINST foreign key (TASKMGMTINSTANCE_) references JBPM_MODULEINSTANCE;
            alter table JBPM_TASKINSTANCE add constraint FK_TASKINST_TOKEN foreign key (TOKEN_) references JBPM_TOKEN;
            alter table JBPM_TASKINSTANCE add constraint FK_TASKINST_SLINST foreign key (SWIMLANINSTANCE_) references JBPM_SWIMLANEINSTANCE;
            alter table JBPM_TASKINSTANCE add constraint FK_TASKINST_TASK foreign key (TASK_) references JBPM_TASK;
            alter table JBPM_TIMER add constraint FK_TIMER_TOKEN foreign key (TOKEN_) references JBPM_TOKEN;
            alter table JBPM_TIMER add constraint FK_TIMER_PRINST foreign key (PROCESSINSTANCE_) references JBPM_PROCESSINSTANCE;
            alter table JBPM_TIMER add constraint FK_TIMER_ACTION foreign key (ACTION_) references JBPM_ACTION;
            alter table JBPM_TIMER add constraint FK_TIMER_TSKINST foreign key (TASKINSTANCE_) references JBPM_TASKINSTANCE;
            alter table JBPM_TOKEN add constraint FK_TOKEN_PARENT foreign key (PARENT_) references JBPM_TOKEN;
            alter table JBPM_TOKEN add constraint FK_TOKEN_NODE foreign key (NODE_) references JBPM_NODE;
            alter table JBPM_TOKEN add constraint FK_TOKEN_PROCINST foreign key (PROCESSINSTANCE_) references JBPM_PROCESSINSTANCE;
            alter table JBPM_TOKEN add constraint FK_TOKEN_SUBPI foreign key (SUBPROCESSINSTANCE_) references JBPM_PROCESSINSTANCE;
            alter table JBPM_TOKENVARIABLEMAP add constraint FK_TKVARMAP_CTXT foreign key (CONTEXTINSTANCE_) references JBPM_MODULEINSTANCE;
            alter table JBPM_TOKENVARIABLEMAP add constraint FK_TKVARMAP_TOKEN foreign key (TOKEN_) references JBPM_TOKEN;
            alter table JBPM_TRANSITION add constraint FK_TRANSITION_TO foreign key (TO_) references JBPM_NODE;
            alter table JBPM_TRANSITION add constraint FK_TRANS_PROCDEF foreign key (PROCESSDEFINITION_) references JBPM_PROCESSDEFINITION;
            alter table JBPM_TRANSITION add constraint FK_TRANSITION_FROM foreign key (FROM_) references JBPM_NODE;
            alter table JBPM_VARIABLEACCESS add constraint FK_VARACC_TSKCTRL foreign key (TASKCONTROLLER_) references JBPM_TASKCONTROLLER;
            alter table JBPM_VARIABLEACCESS add constraint FK_VARACC_SCRIPT foreign key (SCRIPT_) references JBPM_ACTION;
            alter table JBPM_VARIABLEACCESS add constraint FK_VARACC_PROCST foreign key (PROCESSSTATE_) references JBPM_NODE;
            alter table JBPM_VARIABLEINSTANCE add constraint FK_VARINST_TK foreign key (TOKEN_) references JBPM_TOKEN;
            alter table JBPM_VARIABLEINSTANCE add constraint FK_VARINST_TKVARMP foreign key (TOKENVARIABLEMAP_) references JBPM_TOKENVARIABLEMAP;
            alter table JBPM_VARIABLEINSTANCE add constraint FK_VARINST_PRCINST foreign key (PROCESSINSTANCE_) references JBPM_PROCESSINSTANCE;
            alter table JBPM_VARIABLEINSTANCE add constraint FK_VAR_TSKINST foreign key (TASKINSTANCE_) references JBPM_TASKINSTANCE;
            alter table JBPM_VARIABLEINSTANCE add constraint FK_BYTEINST_ARRAY foreign key (BYTEARRAYVALUE_) references JBPM_BYTEARRAY;
            ***************************************************************