
    create table JBPM_ACTIVITY (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        PROCESS_ int8,
        PROPS_ int8,
        NAME_ varchar(255),
        DESCR_ varchar(255),
        HAS_VAR_DEF_ bool,
        HAS_TIMER_DEF_ bool,
        LOCAL_SCOPE_ bool,
        EXEC_ASYNC_ bool,
        SIGNAL_ASYNC_ bool,
        PREV_NEEDED_ bool,
        PARENT_ int8,
        DEFTRANS_ int8,
        BEHAV_DESCR_ int8,
        BEHAV_CLASS_ varchar(255),
        BEHAV_ID_ int8,
        ACTSPROCESS_ int8,
        ACTSPROCESS_IDX_ int4,
        PARENT_IDX_ int4,
        primary key (DBID_)
    );

    create table JBPM_ARGDESCRIPTOR (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        TYPENAME_ varchar(255),
        DESCRIPTOR_ int8,
        OBJARG_DESCR_ int8,
        OBJARG_DESCR_IDX_ int4,
        OPER_ int8,
        OPER_IDX_ int4,
        primary key (DBID_)
    );

    create table JBPM_COMMENT (
        DBID_ int8 not null,
        CLASS_ varchar(255) not null,
        DBVERSION_ int4 not null,
        USERID_ varchar(255),
        TIME_ timestamp,
        MESSAGE_ varchar(255),
        PARENT_ int8,
        PARENT_IDX_ int4,
        TASK_ int8,
        TASK_IDX_ int4,
        primary key (DBID_)
    );

    create table JBPM_DESCRIPTOR (
        DBID_ int8 not null,
        CLASS_ varchar(255) not null,
        DBVERSION_ int4 not null,
        NAME_ varchar(255),
        INIT_ char(1),
        TEXT_ varchar(255),
        DOUBLEVAL_ float8,
        LONGVAL_ int8,
        CLASSNAME_ varchar(255),
        METHOD_ varchar(255),
        BOOLVAL_ bool,
        FACTORYNAME_ varchar(255),
        FACTORYDESCR_ int8,
        VALUEDESCR_ int8,
        VALUEDESCR_IDX_ int4,
        KEYDESCR_ int8,
        KEYDESCR_IDX_ int4,
        PROPS_ int8,
        primary key (DBID_)
    );

    create table JBPM_EVENT (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        PROCESSDEF_ int8,
        PROPS_ int8,
        NAME_ varchar(255),
        PROCESS_ int8,
        ACT_ int8,
        TRANSITION_ int8,
        primary key (DBID_)
    );

    create table JBPM_EXCEPTHNDLR (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        EXCEPT_CLASS_ varchar(255),
        TRANSACT_ bool,
        RETHROW_MASKED_ bool,
        TRANSITIONNAME_ varchar(255),
        NODENAME_ varchar(255),
        PROCESS_ int8,
        PROCESS_IDX_ int4,
        ACT_ int8,
        ACT_IDX_ int4,
        TRANSITION_ int8,
        TRANSITION_IDX_ int4,
        EVENT_ int8,
        EVENT_IDX_ int4,
        primary key (DBID_)
    );

    create table JBPM_EXECUTION (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        ACT_ int8,
        HASVARS_ bool,
        HASTIMERS_ bool,
        NAME_ varchar(255),
        KEY_ varchar(255),
        ID_ varchar(255) unique,
        STATE_ varchar(255),
        PRIORITY_ int4,
        HISACTINST_ int8,
        PROCESS_ int8,
        TRANSITION_ int8,
        TRANSORIG_ int8,
        PARENT_ int8,
        INSTANCE_ int8,
        SUPEREXEC_ int8,
        PARENT_IDX_ int4,
        primary key (DBID_)
    );

    create table JBPM_HIST_ACTINST (
        DBID_ int8 not null,
        CLASS_ varchar(255) not null,
        DBVERSION_ int4 not null,
        HPI_ varchar(255),
        ACTIVITY_ int8,
        EXECUTION_ varchar(255),
        ACTIVITY_NAME_ varchar(255),
        START_ timestamp,
        END_ timestamp,
        DURATION_ int8,
        TRANSITION_ varchar(255),
        ASSIGNEE_ varchar(255),
        primary key (DBID_)
    );

    create table JBPM_HIST_PROCINST (
        ID_ varchar(255) not null,
        DBVERSION_ int4 not null,
        PROCDEFID_ varchar(255),
        KEY_ varchar(255),
        START_ timestamp,
        END_ timestamp,
        DURATION_ int8,
        STATE_ varchar(255),
        ENDACTIVITY_ varchar(255),
        PROCDEF_ int8,
        primary key (ID_)
    );

    create table JBPM_JOB (
        DBID_ int8 not null,
        CLASS_ varchar(255) not null,
        DBVERSION_ int4 not null,
        DUEDATE_ timestamp,
        ISSUSPENDED_ bool,
        ISEXCLUSIVE_ bool,
        LOCKOWNER_ varchar(255),
        LOCKEXPTIME_ timestamp,
        INFO_ varchar(255),
        EXCEPTION_ text,
        RETRIES_ int4,
        PROCESSINSTANCE_ int8,
        EXECUTION_ int8,
        CMDDESCR_ int8,
        SIGNAL_ varchar(255),
        NODE_ int8,
        EVENT_ varchar(255),
        REPEAT_ varchar(255),
        primary key (DBID_)
    );

    create table JBPM_JPDL_ACTIVITY (
        DBID_ int8 not null,
        CLASS_ varchar(255) not null,
        TEXT_ varchar(255),
        TEXT2_ varchar(255),
        EXCLDESCR_ int8,
        ENDPI_ bool,
        ISUNIQ_ bool,
        PARAMDESCR_ int8,
        JAVADESCR_ int8,
        INVOPER_ int8,
        TEXT3_ varchar(255),
        PARTSDESCR_ int8,
        primary key (DBID_)
    );

    create table JBPM_JPDL_EXECUTION (
        DBID_ int8 not null,
        primary key (DBID_)
    );

    create table JBPM_JPDL_PROCDEF (
        DBID_ int8 not null,
        primary key (DBID_)
    );

    create table JBPM_LOB (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        BLOB_VALUE_ oid,
        BINARY_VALUE_ bytea,
        CLOB_VALUE_ text,
        TEXT_VALUE_ text,
        PROCESS_ int8,
        NAME_ varchar(255),
        primary key (DBID_)
    );

    create table JBPM_OBJECTREF (
        DBID_ int8 not null,
        CLASS_ varchar(255) not null,
        DBVERSION_ int4 not null,
        OBJ_DESCR_ int8,
        OBJ_CLASS_ varchar(255),
        OBJ_ID_ int8,
        OBJ_EXPRESSION_ varchar(255),
        OBJ_EXPRLANG_ varchar(255),
        PROPAGATE_ bool,
        EVENT_ int8,
        EVENT_IDX_ int4,
        EXHNDLR_ int8,
        EXHNDLR_IDX_ int4,
        primary key (DBID_)
    );

    create table JBPM_OPERATION (
        DBID_ int8 not null,
        CLASS_ varchar(255) not null,
        DBVERSION_ int4 not null,
        TEXT_ varchar(255),
        DESCR_ int8,
        OBJOPER_DESCR_ int8,
        OBJOPER_DESCR_IDX_ int4,
        primary key (DBID_)
    );

    create table JBPM_PROCESS (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        PROPS_ int8,
        NAME_ varchar(255),
        DESCR_ varchar(255),
        HAS_VAR_DEF_ bool,
        HAS_TIMER_DEF_ bool,
        KEY_ varchar(255),
        ID_ varchar(255) unique,
        PACKAGE_ varchar(255),
        VERSION_ int4,
        DEPLOYED_ timestamp,
        INITIAL_ int8,
        primary key (DBID_)
    );

    create table JBPM_TIMERDEF (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        DUEDATEDESCR_ varchar(255),
        REPEAT_ varchar(255),
        ISEXCL_ bool,
        RETRIES_ int4,
        EVENT_ varchar(255),
        SIGNAL_ varchar(255),
        DUEDATE_ timestamp,
        PROCESS_ int8,
        ACT_ int8,
        primary key (DBID_)
    );

    create table JBPM_TRANSITION (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        PROCESS_ int8,
        PROPS_ int8,
        NAME_ varchar(255),
        DESCR_ varchar(255),
        SRC_ int8,
        DEST_ int8,
        COND_DESCR_ int8,
        TAKEASYNC_ bool,
        DESTINATION_ int8,
        IN_IDX_ int4,
        SOURCE_ int8,
        OUT_IDX_ int4,
        primary key (DBID_)
    );

    create table JBPM_VARIABLE (
        DBID_ int8 not null,
        CLASS_ varchar(255) not null,
        DBVERSION_ int4 not null,
        KEY_ varchar(255),
        QUERYTEXT_ varchar(255),
        CONVERTER_ varchar(255),
        PROCINST_ int8,
        DATE_VALUE_ timestamp,
        DOUBLE_VALUE_ float8,
        LONG_VALUE_ int8,
        STRING_VALUE_ varchar(255),
        LOB_ int8,
        EXECUTION_ int8,
        primary key (DBID_)
    );

    create table JBPM_VARIABLEDEF (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        NAME_ varchar(255),
        TYPE_ varchar(255),
        INVAR_ varchar(255),
        INEXPR_ varchar(255),
        INDESCR_ int8,
        OUTVAR_ varchar(255),
        OUTEXPR_ varchar(255),
        PROCESS_ int8,
        PROCESS_IDX_ int4,
        ACT_ int8,
        ACT_IDX_ int4,
        primary key (DBID_)
    );

    create table JBPM_WIREPROPS (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        primary key (DBID_)
    );

    create table ParticipantImpl (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        IDENTITYTYPE_ varchar(255),
        IDENTITYID_ varchar(255),
        PARTICIPATION_ varchar(255),
        TASK_ int8,
        SWIMLANE_ int8,
        primary key (DBID_)
    );

    create table SwimlaneDefinitionImpl (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        NAME_ varchar(255),
        primary key (DBID_)
    );

    create table SwimlaneImpl (
        DBID_ int8 not null,
        DBVERSION_ int4 not null,
        NAME_ varchar(255),
        ASSIGNEE_ varchar(255),
        SWIMLANEDEF_ int8,
        primary key (DBID_)
    );

    create table TaskDefinitionImpl (
        DBID_ int8 not null,
        CLASS_ char(1) not null,
        DBVERSION_ int4 not null,
        NAME_ varchar(255),
        DESCR_ varchar(255),
        PRIORITY_ int4,
        DUEDATE_ varchar(255),
        BLOCK_ bool,
        SIGNAL_ bool,
        ASSIGNEE_EXPR_ varchar(255),
        CANDIDATES_EXPR_ varchar(255),
        ASSIGNER_DESCR_ int8,
        SWIMLANE_DEF_ int8,
        TASKDEF_ int8,
        TASKDEF_IDX_ int4,
        primary key (DBID_)
    );

    create table TaskImpl (
        DBID_ int8 not null,
        CLASS_ char(1) not null,
        DBVERSION_ int4 not null,
        ID_ varchar(255) unique,
        NAME_ varchar(255),
        DESCR_ varchar(255),
        ASSIGNEE_ varchar(255),
        PRIORITY_ int4,
        CREATE_ timestamp,
        DUEDATE_ timestamp,
        PROGRESS_ int4,
        SUPERTASK_ int8,
        EXECUTION_ int8,
        SWIMLANE_ int8,
        primary key (DBID_)
    );

    create index IDX_ACT_DEFTRANS on JBPM_ACTIVITY (DEFTRANS_);

    create index IDX_ACT_PROCESS on JBPM_ACTIVITY (PROCESS_);

    create index IDX_NODE_BEHAV_DESCR on JBPM_ACTIVITY (BEHAV_DESCR_);

    create index IDX_ACTS_PROCESS on JBPM_ACTIVITY (ACTSPROCESS_);

    create index IDX_ACT_PROPS on JBPM_ACTIVITY (PROPS_);

    create index IDX_ACT_PARENT on JBPM_ACTIVITY (PARENT_);

    alter table JBPM_ACTIVITY 
        add constraint FK_NODE_BEHAV_DESCR 
        foreign key (BEHAV_DESCR_) 
        references JBPM_DESCRIPTOR;

    alter table JBPM_ACTIVITY 
        add constraint FK_ACT_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS;

    alter table JBPM_ACTIVITY 
        add constraint FK_ACT_DEFTRANS 
        foreign key (DEFTRANS_) 
        references JBPM_TRANSITION;

    alter table JBPM_ACTIVITY 
        add constraint FK_ACT_PARENT 
        foreign key (PARENT_) 
        references JBPM_ACTIVITY;

    alter table JBPM_ACTIVITY 
        add constraint FK_ACTS_PROCESS 
        foreign key (ACTSPROCESS_) 
        references JBPM_PROCESS;

    alter table JBPM_ACTIVITY 
        add constraint FK_ACT_PROPS 
        foreign key (PROPS_) 
        references JBPM_WIREPROPS;

    create index IDX_ARGDESCR_DESCR on JBPM_ARGDESCRIPTOR (DESCRIPTOR_);

    create index IDX_OBJARG_DESCR on JBPM_ARGDESCRIPTOR (OBJARG_DESCR_);

    create index IDX_ARGDSCR_OPER on JBPM_ARGDESCRIPTOR (OPER_);

    alter table JBPM_ARGDESCRIPTOR 
        add constraint FK_ARGDSCR_OPER 
        foreign key (OPER_) 
        references JBPM_OPERATION;

    alter table JBPM_ARGDESCRIPTOR 
        add constraint FK_OBJARG_DESCR 
        foreign key (OBJARG_DESCR_) 
        references JBPM_DESCRIPTOR;

    alter table JBPM_ARGDESCRIPTOR 
        add constraint FK_ARGDESCR_DESCR 
        foreign key (DESCRIPTOR_) 
        references JBPM_DESCRIPTOR;

    alter table JBPM_COMMENT 
        add constraint FK7BD9C13586A745AD 
        foreign key (TASK_) 
        references TaskImpl;

    create index IDX_DESCR_VALDESCR on JBPM_DESCRIPTOR (VALUEDESCR_);

    create index IDX_DESCR_PROPS on JBPM_DESCRIPTOR (PROPS_);

    create index IDX_DESCR_ARG_REF on JBPM_DESCRIPTOR (FACTORYDESCR_);

    alter table JBPM_DESCRIPTOR 
        add constraint FK_DESCR_KEYDESCR 
        foreign key (KEYDESCR_) 
        references JBPM_DESCRIPTOR;

    alter table JBPM_DESCRIPTOR 
        add constraint FK_DESCR_VALDESCR 
        foreign key (VALUEDESCR_) 
        references JBPM_DESCRIPTOR;

    alter table JBPM_DESCRIPTOR 
        add constraint FK_DESCR_ARG_REF 
        foreign key (FACTORYDESCR_) 
        references JBPM_DESCRIPTOR;

    alter table JBPM_DESCRIPTOR 
        add constraint FK_DESCR_PROPS 
        foreign key (PROPS_) 
        references JBPM_WIREPROPS;

    create index IDX_EVENT_PROCESS on JBPM_EVENT (PROCESS_);

    create index IDX_EVENT_PROPS on JBPM_EVENT (PROPS_);

    create index IDX_EVENT_TRANS on JBPM_EVENT (TRANSITION_);

    create index IDX_EVENT_ACT on JBPM_EVENT (ACT_);

    create index IDX_EVENT_PROCDEF on JBPM_EVENT (PROCESSDEF_);

    alter table JBPM_EVENT 
        add constraint FK_EVENT_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS;

    alter table JBPM_EVENT 
        add constraint FK_EVENT_ACT 
        foreign key (ACT_) 
        references JBPM_ACTIVITY;

    alter table JBPM_EVENT 
        add constraint FK_EVENT_PROCDEF 
        foreign key (PROCESSDEF_) 
        references JBPM_PROCESS;

    alter table JBPM_EVENT 
        add constraint FK_EVENT_TRANS 
        foreign key (TRANSITION_) 
        references JBPM_TRANSITION;

    alter table JBPM_EVENT 
        add constraint FK_EVENT_PROPS 
        foreign key (PROPS_) 
        references JBPM_WIREPROPS;

    create index IDX_EXHDLR_EVENT on JBPM_EXCEPTHNDLR (EVENT_);

    create index IDX_EXHDLR_PROCESS on JBPM_EXCEPTHNDLR (PROCESS_);

    create index IDX_EXHDLR_ACT on JBPM_EXCEPTHNDLR (ACT_);

    create index IDX_EXHDLR_TRANS on JBPM_EXCEPTHNDLR (TRANSITION_);

    alter table JBPM_EXCEPTHNDLR 
        add constraint FK_EXHDLR_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS;

    alter table JBPM_EXCEPTHNDLR 
        add constraint FK_EXHDLR_EVENT 
        foreign key (EVENT_) 
        references JBPM_EVENT;

    alter table JBPM_EXCEPTHNDLR 
        add constraint FK_EXHDLR_ACT 
        foreign key (ACT_) 
        references JBPM_ACTIVITY;

    alter table JBPM_EXCEPTHNDLR 
        add constraint FK_EXHDLR_TRANS 
        foreign key (TRANSITION_) 
        references JBPM_TRANSITION;

    create index IDX_EXEC_TRANSORIG on JBPM_EXECUTION (TRANSORIG_);

    create index IDX_EXEC_PROCESS on JBPM_EXECUTION (PROCESS_);

    create index IDX_EXEC_SUPEREXEC on JBPM_EXECUTION (SUPEREXEC_);

    create index IDX_EXEC_INSTANCE on JBPM_EXECUTION (INSTANCE_);

    create index IDX_EXEC_ACT on JBPM_EXECUTION (ACT_);

    create index IDX_EXEC_PARENT on JBPM_EXECUTION (PARENT_);

    alter table JBPM_EXECUTION 
        add constraint FK_EXEC_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS;

    alter table JBPM_EXECUTION 
        add constraint FK_EXEC_ACT 
        foreign key (ACT_) 
        references JBPM_ACTIVITY;

    alter table JBPM_EXECUTION 
        add constraint FK_EXEC_PARENT 
        foreign key (PARENT_) 
        references JBPM_EXECUTION;

    alter table JBPM_EXECUTION 
        add constraint FK_EXEC_INSTANCE 
        foreign key (INSTANCE_) 
        references JBPM_EXECUTION;

    alter table JBPM_EXECUTION 
        add constraint FK_EXEC_TRANSORIG 
        foreign key (TRANSORIG_) 
        references JBPM_ACTIVITY;

    alter table JBPM_EXECUTION 
        add constraint FK_EXEC_SUPEREXEC 
        foreign key (SUPEREXEC_) 
        references JBPM_EXECUTION;

    alter table JBPM_EXECUTION 
        add constraint FK4837C6E47026E1F 
        foreign key (TRANSITION_) 
        references JBPM_TRANSITION;

    create index IDX_HISTAI_ACT on JBPM_HIST_ACTINST (ACTIVITY_);

    create index IDX_HAI_HPI on JBPM_HIST_ACTINST (HPI_);

    alter table JBPM_HIST_ACTINST 
        add constraint FK_HISTAI_ACT 
        foreign key (ACTIVITY_) 
        references JBPM_ACTIVITY;

    alter table JBPM_HIST_ACTINST 
        add constraint FK_HAI_HPI 
        foreign key (HPI_) 
        references JBPM_HIST_PROCINST;

    create index IDX_HISTPI_PROCDEF on JBPM_HIST_PROCINST (PROCDEF_);

    alter table JBPM_HIST_PROCINST 
        add constraint FK_HISTPI_PROCDEF 
        foreign key (PROCDEF_) 
        references JBPM_PROCESS;

    create index IDX_JOBRETRIES on JBPM_JOB (RETRIES_);

    create index IDX_JOB_CMDDESCR on JBPM_JOB (CMDDESCR_);

    create index IDX_JOB_PRINST on JBPM_JOB (PROCESSINSTANCE_);

    create index IDX_JOB_EXE on JBPM_JOB (EXECUTION_);

    create index IDX_JOBLOCKEXP on JBPM_JOB (LOCKEXPTIME_);

    create index IDX_JOBDUEDATE on JBPM_JOB (DUEDATE_);

    alter table JBPM_JOB 
        add constraint FK_JOB_NODE 
        foreign key (NODE_) 
        references JBPM_ACTIVITY;

    alter table JBPM_JOB 
        add constraint FK_JOB_PRINST 
        foreign key (PROCESSINSTANCE_) 
        references JBPM_EXECUTION;

    alter table JBPM_JOB 
        add constraint FK_TMR_EXECUTION 
        foreign key (EXECUTION_) 
        references JBPM_EXECUTION;

    alter table JBPM_JOB 
        add constraint FK_JOB_CMDDESCR 
        foreign key (CMDDESCR_) 
        references JBPM_DESCRIPTOR;

    create index IDX_ACT_JAVADESCR on JBPM_JPDL_ACTIVITY (JAVADESCR_);

    create index IDX_ACT_EXCLDESCR on JBPM_JPDL_ACTIVITY (EXCLDESCR_);

    create index IDX_ACT_PARAMDESCR on JBPM_JPDL_ACTIVITY (PARAMDESCR_);

    create index IDX_ACT_INVKOPER on JBPM_JPDL_ACTIVITY (INVOPER_);

    create index IDX_ACT_PARTSDESCR on JBPM_JPDL_ACTIVITY (PARTSDESCR_);

    alter table JBPM_JPDL_ACTIVITY 
        add constraint FK_ACT_EXCLDESCR 
        foreign key (EXCLDESCR_) 
        references JBPM_DESCRIPTOR;

    alter table JBPM_JPDL_ACTIVITY 
        add constraint FK_ACT_JAVADESCR 
        foreign key (JAVADESCR_) 
        references JBPM_DESCRIPTOR;

    alter table JBPM_JPDL_ACTIVITY 
        add constraint FK_ACT_PARTSDESCR 
        foreign key (PARTSDESCR_) 
        references JBPM_DESCRIPTOR;

    alter table JBPM_JPDL_ACTIVITY 
        add constraint FK_ACT_INVKOPER 
        foreign key (INVOPER_) 
        references JBPM_OPERATION;

    alter table JBPM_JPDL_ACTIVITY 
        add constraint FK_ACT_PARAMDESCR 
        foreign key (PARAMDESCR_) 
        references JBPM_DESCRIPTOR;

    alter table JBPM_JPDL_EXECUTION 
        add constraint FKA5B37C91F3DBDB5E 
        foreign key (DBID_) 
        references JBPM_EXECUTION;

    alter table JBPM_JPDL_PROCDEF 
        add constraint FK4D2898A820C24C68 
        foreign key (DBID_) 
        references JBPM_PROCESS;

    create index IDX_LOB_PROCESS on JBPM_LOB (PROCESS_);

    alter table JBPM_LOB 
        add constraint FK_LOB_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS;

    create index IDX_OBJREF_EXHNDLR on JBPM_OBJECTREF (EXHNDLR_);

    create index IDX_OBJREF_EVENT on JBPM_OBJECTREF (OBJ_DESCR_, EVENT_);

    alter table JBPM_OBJECTREF 
        add constraint FK_OBJECTREF_EVENT 
        foreign key (EVENT_) 
        references JBPM_EVENT;

    alter table JBPM_OBJECTREF 
        add constraint FK_OBJREF_EVENT 
        foreign key (OBJ_DESCR_) 
        references JBPM_DESCRIPTOR;

    alter table JBPM_OBJECTREF 
        add constraint FK_OBJREF_EXHNDLR 
        foreign key (EXHNDLR_) 
        references JBPM_EXCEPTHNDLR;

    create index IDX_OBJOPER_DESCR on JBPM_OPERATION (OBJOPER_DESCR_);

    create index IDX_OPER_DESC on JBPM_OPERATION (DESCR_);

    alter table JBPM_OPERATION 
        add constraint FK_OBJOPER_DESCR 
        foreign key (OBJOPER_DESCR_) 
        references JBPM_DESCRIPTOR;

    alter table JBPM_OPERATION 
        add constraint FK_OPER_DESC 
        foreign key (DESCR_) 
        references JBPM_DESCRIPTOR;

    create index IDX_PROCDEF_PROPS on JBPM_PROCESS (PROPS_);

    create index IDX_PROCDEF_INIT on JBPM_PROCESS (INITIAL_);

    alter table JBPM_PROCESS 
        add constraint FK_PROCDEF_INITIAL 
        foreign key (INITIAL_) 
        references JBPM_ACTIVITY;

    alter table JBPM_PROCESS 
        add constraint FK_PROCDEF_PROPS 
        foreign key (PROPS_) 
        references JBPM_WIREPROPS;

    create index IDX_TMRDEF_PROCESS on JBPM_TIMERDEF (PROCESS_);

    create index IDX_TMRDEF_ACT on JBPM_TIMERDEF (ACT_);

    alter table JBPM_TIMERDEF 
        add constraint FK_TMRDEF_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS;

    alter table JBPM_TIMERDEF 
        add constraint FK_TMRDEF_ACT 
        foreign key (ACT_) 
        references JBPM_ACTIVITY;

    create index IDX_TRANS_DST on JBPM_TRANSITION (DEST_);

    create index IDX_TRANS_COND on JBPM_TRANSITION (COND_DESCR_);

    create index IDX_TRANS_SRC on JBPM_TRANSITION (SRC_);

    create index IDX_TRANS_PROPS on JBPM_TRANSITION (PROPS_);

    create index IDX_TRANS_PROCDEF on JBPM_TRANSITION (PROCESS_);

    alter table JBPM_TRANSITION 
        add constraint FK_TRANS_PROCDEF 
        foreign key (PROCESS_) 
        references JBPM_PROCESS;

    alter table JBPM_TRANSITION 
        add constraint FK_TRANS_COND 
        foreign key (COND_DESCR_) 
        references JBPM_DESCRIPTOR;

    alter table JBPM_TRANSITION 
        add constraint FK_TRANS_DST 
        foreign key (DEST_) 
        references JBPM_ACTIVITY;

    alter table JBPM_TRANSITION 
        add constraint FK_TRANS_SRC 
        foreign key (SRC_) 
        references JBPM_ACTIVITY;

    alter table JBPM_TRANSITION 
        add constraint FK4FF269FD5B03CD3 
        foreign key (SOURCE_) 
        references JBPM_ACTIVITY;

    alter table JBPM_TRANSITION 
        add constraint FK4FF269FFC35DF40 
        foreign key (DESTINATION_) 
        references JBPM_ACTIVITY;

    alter table JBPM_TRANSITION 
        add constraint FK_TRANS_PROPS 
        foreign key (PROPS_) 
        references JBPM_WIREPROPS;

    create index IDX_VAR_PROCINST on JBPM_VARIABLE (PROCINST_);

    create index IDX_VAR_EXECUTION on JBPM_VARIABLE (EXECUTION_);

    create index IDX_VAR_LOB on JBPM_VARIABLE (LOB_);

    alter table JBPM_VARIABLE 
        add constraint FK_VAR_PROCINST 
        foreign key (PROCINST_) 
        references JBPM_EXECUTION;

    alter table JBPM_VARIABLE 
        add constraint FK_VAR_LOB 
        foreign key (LOB_) 
        references JBPM_LOB;

    alter table JBPM_VARIABLE 
        add constraint FK_VAR_EXECUTION 
        foreign key (EXECUTION_) 
        references JBPM_EXECUTION;

    create index IDX_VARDEF_INDES on JBPM_VARIABLEDEF (INDESCR_);

    create index IDX_VARDEF_ACT on JBPM_VARIABLEDEF (ACT_);

    create index IDX_VARDEF_PROCESS on JBPM_VARIABLEDEF (PROCESS_);

    alter table JBPM_VARIABLEDEF 
        add constraint FK_VARDEF_PROCESS 
        foreign key (PROCESS_) 
        references JBPM_PROCESS;

    alter table JBPM_VARIABLEDEF 
        add constraint FK_VARDEF_ACT 
        foreign key (ACT_) 
        references JBPM_ACTIVITY;

    alter table JBPM_VARIABLEDEF 
        add constraint FK_VARDEF_INDES 
        foreign key (INDESCR_) 
        references JBPM_DESCRIPTOR;

    create index IDX_PART_TASK on ParticipantImpl (TASK_);

    alter table ParticipantImpl 
        add constraint FK_PART_SWIMLANE 
        foreign key (SWIMLANE_) 
        references SwimlaneImpl;

    alter table ParticipantImpl 
        add constraint FK_PART_TASK 
        foreign key (TASK_) 
        references TaskImpl;

    alter table SwimlaneImpl 
        add constraint FK_SWIMLANE_DEF 
        foreign key (SWIMLANEDEF_) 
        references SwimlaneDefinitionImpl;

    create index IDX_TSK_SWIML_DEF on TaskDefinitionImpl (SWIMLANE_DEF_);

    create index IDX_TSK_ASIG_DESCR on TaskDefinitionImpl (ASSIGNER_DESCR_);

    alter table TaskDefinitionImpl 
        add constraint FK_TSK_SWIML_DEF 
        foreign key (SWIMLANE_DEF_) 
        references SwimlaneDefinitionImpl;

    alter table TaskDefinitionImpl 
        add constraint FK7E595B18496CBE65 
        foreign key (TASKDEF_) 
        references TaskDefinitionImpl;

    alter table TaskDefinitionImpl 
        add constraint FK_TSK_ASIG_DESCR 
        foreign key (ASSIGNER_DESCR_) 
        references JBPM_DESCRIPTOR;

    create index IDX_TASK_SUPERTASK on TaskImpl (SUPERTASK_);

    alter table TaskImpl 
        add constraint FK_TASK_SWIML 
        foreign key (SWIMLANE_) 
        references SwimlaneImpl;

    alter table TaskImpl 
        add constraint FK_TASK_EXEC 
        foreign key (EXECUTION_) 
        references JBPM_EXECUTION;

    alter table TaskImpl 
        add constraint FK_TASK_SUPERTASK 
        foreign key (SUPERTASK_) 
        references TaskImpl;

    create sequence hibernate_sequence;
