
    create table JBPM_ACTIVITY (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        PROCESS_ number(19,0),
        PROPS_ number(19,0),
        NAME_ varchar2(255 char),
        DESCR_ varchar2(255 char),
        HAS_VAR_DEF_ number(1,0),
        HAS_TIMER_DEF_ number(1,0),
        LOCAL_SCOPE_ number(1,0),
        EXEC_ASYNC_ number(1,0),
        SIGNAL_ASYNC_ number(1,0),
        PREV_NEEDED_ number(1,0),
        PARENT_ number(19,0),
        DEFTRANS_ number(19,0),
        BEHAV_DESCR_ number(19,0),
        BEHAV_CLASS_ varchar2(255 char),
        BEHAV_ID_ number(19,0),
        ACTSPROCESS_ number(19,0),
        ACTSPROCESS_IDX_ number(10,0),
        PARENT_IDX_ number(10,0),
        primary key (DBID_)
    );

    create table JBPM_ARGDESCRIPTOR (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        TYPENAME_ varchar2(255 char),
        DESCRIPTOR_ number(19,0),
        OBJARG_DESCR_ number(19,0),
        OBJARG_DESCR_IDX_ number(10,0),
        OPER_ number(19,0),
        OPER_IDX_ number(10,0),
        primary key (DBID_)
    );

    create table JBPM_COMMENT (
        DBID_ number(19,0) not null,
        CLASS_ varchar2(255 char) not null,
        DBVERSION_ number(10,0) not null,
        USERID_ varchar2(255 char),
        TIME_ timestamp,
        MESSAGE_ varchar2(255 char),
        PARENT_ number(19,0),
        PARENT_IDX_ number(10,0),
        TASK_ number(19,0),
        TASK_IDX_ number(10,0),
        primary key (DBID_)
    );

    create table JBPM_DESCRIPTOR (
        DBID_ number(19,0) not null,
        CLASS_ varchar2(255 char) not null,
        DBVERSION_ number(10,0) not null,
        NAME_ varchar2(255 char),
        INIT_ char(1 char),
        TEXT_ varchar2(255 char),
        DOUBLEVAL_ double precision,
        LONGVAL_ number(19,0),
        CLASSNAME_ varchar2(255 char),
        METHOD_ varchar2(255 char),
        BOOLVAL_ number(1,0),
        FACTORYNAME_ varchar2(255 char),
        FACTORYDESCR_ number(19,0),
        VALUEDESCR_ number(19,0),
        VALUEDESCR_IDX_ number(10,0),
        KEYDESCR_ number(19,0),
        KEYDESCR_IDX_ number(10,0),
        PROPS_ number(19,0),
        primary key (DBID_)
    );

    create table JBPM_EVENT (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        PROCESSDEF_ number(19,0),
        PROPS_ number(19,0),
        NAME_ varchar2(255 char),
        PROCESS_ number(19,0),
        ACT_ number(19,0),
        TRANSITION_ number(19,0),
        primary key (DBID_)
    );

    create table JBPM_EXCEPTHNDLR (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        EXCEPT_CLASS_ varchar2(255 char),
        TRANSACT_ number(1,0),
        RETHROW_MASKED_ number(1,0),
        TRANSITIONNAME_ varchar2(255 char),
        NODENAME_ varchar2(255 char),
        PROCESS_ number(19,0),
        PROCESS_IDX_ number(10,0),
        ACT_ number(19,0),
        ACT_IDX_ number(10,0),
        TRANSITION_ number(19,0),
        TRANSITION_IDX_ number(10,0),
        EVENT_ number(19,0),
        EVENT_IDX_ number(10,0),
        primary key (DBID_)
    );

    create table JBPM_EXECUTION (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        ACT_ number(19,0),
        HASVARS_ number(1,0),
        HASTIMERS_ number(1,0),
        NAME_ varchar2(255 char),
        KEY_ varchar2(255 char),
        ID_ varchar2(255 char) unique,
        STATE_ varchar2(255 char),
        PRIORITY_ number(10,0),
        HISACTINST_ number(19,0),
        PROCESS_ number(19,0),
        TRANSITION_ number(19,0),
        TRANSORIG_ number(19,0),
        PARENT_ number(19,0),
        INSTANCE_ number(19,0),
        SUPEREXEC_ number(19,0),
        PARENT_IDX_ number(10,0),
        primary key (DBID_)
    );

    create table JBPM_HIST_ACTINST (
        DBID_ number(19,0) not null,
        CLASS_ varchar2(255 char) not null,
        DBVERSION_ number(10,0) not null,
        HPI_ varchar2(255 char),
        ACTIVITY_ number(19,0),
        EXECUTION_ varchar2(255 char),
        ACTIVITY_NAME_ varchar2(255 char),
        START_ timestamp,
        END_ timestamp,
        DURATION_ number(19,0),
        TRANSITION_ varchar2(255 char),
        ASSIGNEE_ varchar2(255 char),
        primary key (DBID_)
    );

    create table JBPM_HIST_PROCINST (
        ID_ varchar2(255 char) not null,
        DBVERSION_ number(10,0) not null,
        PROCDEFID_ varchar2(255 char),
        KEY_ varchar2(255 char),
        START_ timestamp,
        END_ timestamp,
        DURATION_ number(19,0),
        STATE_ varchar2(255 char),
        ENDACTIVITY_ varchar2(255 char),
        PROCDEF_ number(19,0),
        primary key (ID_)
    );

    create table JBPM_JOB (
        DBID_ number(19,0) not null,
        CLASS_ varchar2(255 char) not null,
        DBVERSION_ number(10,0) not null,
        DUEDATE_ timestamp,
        ISSUSPENDED_ number(1,0),
        ISEXCLUSIVE_ number(1,0),
        LOCKOWNER_ varchar2(255 char),
        LOCKEXPTIME_ timestamp,
        INFO_ varchar2(255 char),
        EXCEPTION_ clob,
        RETRIES_ number(10,0),
        PROCESSINSTANCE_ number(19,0),
        EXECUTION_ number(19,0),
        CMDDESCR_ number(19,0),
        SIGNAL_ varchar2(255 char),
        NODE_ number(19,0),
        EVENT_ varchar2(255 char),
        REPEAT_ varchar2(255 char),
        primary key (DBID_)
    );

    create table JBPM_JPDL_ACTIVITY (
        DBID_ number(19,0) not null,
        CLASS_ varchar2(255 char) not null,
        TEXT_ varchar2(255 char),
        TEXT2_ varchar2(255 char),
        EXCLDESCR_ number(19,0),
        ENDPI_ number(1,0),
        ISUNIQ_ number(1,0),
        PARAMDESCR_ number(19,0),
        JAVADESCR_ number(19,0),
        INVOPER_ number(19,0),
        TEXT3_ varchar2(255 char),
        PARTSDESCR_ number(19,0),
        primary key (DBID_)
    );

    create table JBPM_JPDL_EXECUTION (
        DBID_ number(19,0) not null,
        primary key (DBID_)
    );

    create table JBPM_JPDL_PROCDEF (
        DBID_ number(19,0) not null,
        primary key (DBID_)
    );

    create table JBPM_LOB (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        BLOB_VALUE_ blob,
        BINARY_VALUE_ raw(255),
        CLOB_VALUE_ clob,
        TEXT_VALUE_ clob,
        PROCESS_ number(19,0),
        NAME_ varchar2(255 char),
        primary key (DBID_)
    );

    create table JBPM_OBJECTREF (
        DBID_ number(19,0) not null,
        CLASS_ varchar2(255 char) not null,
        DBVERSION_ number(10,0) not null,
        OBJ_DESCR_ number(19,0),
        OBJ_CLASS_ varchar2(255 char),
        OBJ_ID_ number(19,0),
        OBJ_EXPRESSION_ varchar2(255 char),
        OBJ_EXPRLANG_ varchar2(255 char),
        PROPAGATE_ number(1,0),
        EVENT_ number(19,0),
        EVENT_IDX_ number(10,0),
        EXHNDLR_ number(19,0),
        EXHNDLR_IDX_ number(10,0),
        primary key (DBID_)
    );

    create table JBPM_OPERATION (
        DBID_ number(19,0) not null,
        CLASS_ varchar2(255 char) not null,
        DBVERSION_ number(10,0) not null,
        TEXT_ varchar2(255 char),
        DESCR_ number(19,0),
        OBJOPER_DESCR_ number(19,0),
        OBJOPER_DESCR_IDX_ number(10,0),
        primary key (DBID_)
    );

    create table JBPM_PROCESS (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        PROPS_ number(19,0),
        NAME_ varchar2(255 char),
        DESCR_ varchar2(255 char),
        HAS_VAR_DEF_ number(1,0),
        HAS_TIMER_DEF_ number(1,0),
        KEY_ varchar2(255 char),
        ID_ varchar2(255 char) unique,
        PACKAGE_ varchar2(255 char),
        VERSION_ number(10,0),
        DEPLOYED_ timestamp,
        INITIAL_ number(19,0),
        primary key (DBID_)
    );

    create table JBPM_TIMERDEF (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        DUEDATEDESCR_ varchar2(255 char),
        REPEAT_ varchar2(255 char),
        ISEXCL_ number(1,0),
        RETRIES_ number(10,0),
        EVENT_ varchar2(255 char),
        SIGNAL_ varchar2(255 char),
        DUEDATE_ timestamp,
        PROCESS_ number(19,0),
        ACT_ number(19,0),
        primary key (DBID_)
    );

    create table JBPM_TRANSITION (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        PROCESS_ number(19,0),
        PROPS_ number(19,0),
        NAME_ varchar2(255 char),
        DESCR_ varchar2(255 char),
        SRC_ number(19,0),
        DEST_ number(19,0),
        COND_DESCR_ number(19,0),
        TAKEASYNC_ number(1,0),
        DESTINATION_ number(19,0),
        IN_IDX_ number(10,0),
        SOURCE_ number(19,0),
        OUT_IDX_ number(10,0),
        primary key (DBID_)
    );

    create table JBPM_VARIABLE (
        DBID_ number(19,0) not null,
        CLASS_ varchar2(255 char) not null,
        DBVERSION_ number(10,0) not null,
        KEY_ varchar2(255 char),
        QUERYTEXT_ varchar2(255 char),
        CONVERTER_ varchar2(255 char),
        PROCINST_ number(19,0),
        DATE_VALUE_ timestamp,
        DOUBLE_VALUE_ double precision,
        LONG_VALUE_ number(19,0),
        STRING_VALUE_ varchar2(255 char),
        LOB_ number(19,0),
        EXECUTION_ number(19,0),
        primary key (DBID_)
    );

    create table JBPM_VARIABLEDEF (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        NAME_ varchar2(255 char),
        TYPE_ varchar2(255 char),
        INVAR_ varchar2(255 char),
        INEXPR_ varchar2(255 char),
        INDESCR_ number(19,0),
        OUTVAR_ varchar2(255 char),
        OUTEXPR_ varchar2(255 char),
        PROCESS_ number(19,0),
        PROCESS_IDX_ number(10,0),
        ACT_ number(19,0),
        ACT_IDX_ number(10,0),
        primary key (DBID_)
    );

    create table JBPM_WIREPROPS (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        primary key (DBID_)
    );

    create table ParticipantImpl (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        IDENTITYTYPE_ varchar2(255 char),
        IDENTITYID_ varchar2(255 char),
        PARTICIPATION_ varchar2(255 char),
        TASK_ number(19,0),
        SWIMLANE_ number(19,0),
        primary key (DBID_)
    );

    create table SwimlaneDefinitionImpl (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        NAME_ varchar2(255 char),
        primary key (DBID_)
    );

    create table SwimlaneImpl (
        DBID_ number(19,0) not null,
        DBVERSION_ number(10,0) not null,
        NAME_ varchar2(255 char),
        ASSIGNEE_ varchar2(255 char),
        SWIMLANEDEF_ number(19,0),
        primary key (DBID_)
    );

    create table TaskDefinitionImpl (
        DBID_ number(19,0) not null,
        CLASS_ char(1 char) not null,
        DBVERSION_ number(10,0) not null,
        NAME_ varchar2(255 char),
        DESCR_ varchar2(255 char),
        PRIORITY_ number(10,0),
        DUEDATE_ varchar2(255 char),
        BLOCK_ number(1,0),
        SIGNAL_ number(1,0),
        ASSIGNEE_EXPR_ varchar2(255 char),
        CANDIDATES_EXPR_ varchar2(255 char),
        ASSIGNER_DESCR_ number(19,0),
        SWIMLANE_DEF_ number(19,0),
        TASKDEF_ number(19,0),
        TASKDEF_IDX_ number(10,0),
        primary key (DBID_)
    );

    create table TaskImpl (
        DBID_ number(19,0) not null,
        CLASS_ char(1 char) not null,
        DBVERSION_ number(10,0) not null,
        ID_ varchar2(255 char) unique,
        NAME_ varchar2(255 char),
        DESCR_ varchar2(255 char),
        ASSIGNEE_ varchar2(255 char),
        PRIORITY_ number(10,0),
        CREATE_ timestamp,
        DUEDATE_ timestamp,
        PROGRESS_ number(10,0),
        SUPERTASK_ number(19,0),
        EXECUTION_ number(19,0),
        SWIMLANE_ number(19,0),
        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;
