
CREATE TABLE JBPM_ACTION ( 
  ID                NUMBER (19)   NOT NULL, 
  ELEMENT_TYPE      VARCHAR2 (255), 
  ELEMENT           NUMBER (19), 
  INDEX_            NUMBER (10), 
  EVENTTYPE         VARCHAR2 (255), 
  ACTIONDELEGATION  NUMBER (19), 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_DEFINITION ( 
  ID           NUMBER (19)   NOT NULL, 
  NAME         VARCHAR2 (255), 
  DESCRIPTION  VARCHAR2 (255), 
  DEFINITION   NUMBER (19), 
  VERSION_     NUMBER (10), 
  STARTSTATE   NUMBER (19), 
  ENDSTATE     NUMBER (19), 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_DELEGATION ( 
  ID             NUMBER (19)   NOT NULL, 
  DEFINITION     NUMBER (19), 
  CLASSNAME      VARCHAR2 (255), 
  CONFIGURATION  VARCHAR2 (1000),
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_EXELOG ( 
  ID                NUMBER (19)   NOT NULL, 
  CLASS             VARCHAR2 (255)  NOT NULL, 
  INVOCATIONLOG     NUMBER (19), 
  INDEX_            NUMBER (10), 
  VARINST1          NUMBER (19), 
  TEXT1             VARCHAR2 (255), 
  TEXT2             VARCHAR2 (255), 
  VARINST2          NUMBER (19), 
  ACTION_           NUMBER (19), 
  PREVIOUS          NUMBER (19), 
  STATE             NUMBER (19), 
  TOKEN             NUMBER (19), 
  INT_ONE           NUMBER (10), 
  SUBTOKEN			NUMBER (19),
  VARIABLEINSTANCE  NUMBER (19), 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_FILE ( 
  ID            NUMBER (19)   NOT NULL, 
  NAME          VARCHAR2 (255), 
  DEFINITIONID  NUMBER (19), 
  BYTES         LONG RAW, 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_INVOKELOG ( 
  ID             NUMBER (19)   NOT NULL, 
  ACTORID        VARCHAR2 (255), 
  TOKEN          NUMBER (19), 
  DATE_          DATE, 
  SERVICEMETHOD  VARCHAR2 (255), 
  ISUNDOABLE     NUMBER (1), 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_JOB ( 
  ID                NUMBER (19)   NOT NULL, 
  ACTIONDELEGATION  NUMBER (19), 
  TOKEN             NUMBER (19), 
  PROCESSINSTANCE   NUMBER (19), 
  DUEDATE           DATE, 
  REPEAT_           NUMBER (19),
  REFERENCE         VARCHAR2 (255), 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_NODE ( 
  ID                   NUMBER (19)   NOT NULL, 
  CLASS                VARCHAR2 (255)  NOT NULL, 
  NAME                 VARCHAR2 (255), 
  DESCRIPTION          VARCHAR2 (255), 
  DEFINITION           NUMBER (19), 
  SWIMLANE             NUMBER (19), 
  ASSIGNMENTREQUIRED   NUMBER (1), 
  STATEAUTHENTICATION  VARCHAR2 (255), 
  DELEGATION           NUMBER (19), 
  CORRESPONDINGJOIN    NUMBER (19), 
  CORRESPONDINGFORK    NUMBER (19), 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_PROCESSINSTANCE ( 
  ID                 NUMBER (19)   NOT NULL, 
  DEFINITION         NUMBER (19), 
  ROOT               NUMBER (19), 
  SUPERPROCESSTOKEN  NUMBER (19), 
  START_             DATE, 
  END_               DATE, 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_SEQUENCEBLOCK ( 
  ID      NUMBER (19)   NOT NULL, 
  NEXTID  NUMBER (19), 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_SWIMLANE ( 
  ID           NUMBER (19)   NOT NULL, 
  NAME         VARCHAR2 (255), 
  DESCRIPTION  VARCHAR2 (255), 
  DEFINITION   NUMBER (19), 
  DELEGATION   NUMBER (19), 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_TOKEN ( 
  ID                  NUMBER (19)   NOT NULL, 
  NAME                VARCHAR2 (255), 
  PROCESSINSTANCE     NUMBER (19), 
  PARENT              NUMBER (19), 
  STATE               NUMBER (19), 
  ACTORID             VARCHAR2 (255), 
  START_              DATE, 
  END_                DATE, 
  REACTIVATIONJOIN    NUMBER (19), 
  SUBPROCESSINSTANCE  NUMBER (19), 
  LASTSTATELOG        NUMBER (19), 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_TRANSITION ( 
  ID           NUMBER (19)   NOT NULL, 
  NAME         VARCHAR2 (255), 
  DESCRIPTION  VARCHAR2 (255), 
  DEFINITION   NUMBER (19), 
  FROM_        NUMBER (19), 
  TO_          NUMBER (19), 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_TYPE ( 
  ID           NUMBER (19)   NOT NULL, 
  INDEX_       NUMBER (10), 
  DESCRIPTION  VARCHAR2 (255), 
  JAVATYPE     VARCHAR2 (255), 
  DEFINITION   NUMBER (19), 
  DELEGATION   NUMBER (19), 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_VARIABLE ( 
  ID          NUMBER (19)   NOT NULL, 
  NAME        VARCHAR2 (255), 
  DEFINITION  NUMBER (19), 
  TYPE_       NUMBER (19), 
  PRIMARY KEY ( ID ) ) ; 

CREATE TABLE JBPM_VARIABLEINSTANCE ( 
  ID               NUMBER (19)   NOT NULL, 
  NAME             VARCHAR2 (255), 
  SERIALIZEDVALUE  VARCHAR2 (4000), 
  DEFAULTTYPE      VARCHAR2 (255), 
  TYPE_            NUMBER (19), 
  TOKEN            NUMBER (19), 
  PRIMARY KEY ( ID ) ) ; 

ALTER TABLE JBPM_ACTION ADD  CONSTRAINT FKAD5A74807E4E3BFE
 FOREIGN KEY (ACTIONDELEGATION) 
  REFERENCES JBPM.JBPM_DELEGATION (ID) ;

ALTER TABLE JBPM_DEFINITION ADD  CONSTRAINT FK2F4CEE9D66309C76
 FOREIGN KEY (ENDSTATE) 
  REFERENCES JBPM.JBPM_NODE (ID) ;

ALTER TABLE JBPM_DEFINITION ADD  CONSTRAINT FK2F4CEE9DA1927D4F
 FOREIGN KEY (STARTSTATE) 
  REFERENCES JBPM.JBPM_NODE (ID) ;

ALTER TABLE JBPM_DEFINITION ADD  CONSTRAINT FK2F4CEE9DC3893553
 FOREIGN KEY (DEFINITION) 
  REFERENCES JBPM.JBPM_DEFINITION (ID) ;

ALTER TABLE JBPM_DELEGATION ADD  CONSTRAINT FKBE986672C3893553
 FOREIGN KEY (DEFINITION) 
  REFERENCES JBPM.JBPM_DEFINITION (ID) ;

ALTER TABLE JBPM_EXELOG ADD  CONSTRAINT FKB54EFE3C13ED2894
 FOREIGN KEY (INVOCATIONLOG) 
  REFERENCES JBPM.JBPM_INVOKELOG (ID) ;

ALTER TABLE JBPM_EXELOG ADD  CONSTRAINT FKB54EFE3C68AC491
 FOREIGN KEY (STATE) 
  REFERENCES JBPM.JBPM_NODE (ID) ;

ALTER TABLE JBPM_EXELOG ADD  CONSTRAINT FKB54EFE3C696B9F9
 FOREIGN KEY (TOKEN) 
  REFERENCES JBPM.JBPM_TOKEN (ID) ;

ALTER TABLE JBPM_EXELOG ADD  CONSTRAINT FKB54EFE3CAA98F31
 FOREIGN KEY (VARIABLEINSTANCE) 
  REFERENCES JBPM.JBPM_VARIABLEINSTANCE (ID) ;

ALTER TABLE JBPM_EXELOG ADD  CONSTRAINT FKB54EFE3CB413BAF7
 FOREIGN KEY (PREVIOUS) 
  REFERENCES JBPM.JBPM_EXELOG (ID) ;

ALTER TABLE JBPM_EXELOG ADD  CONSTRAINT FKB54EFE3CB58AFBE4
 FOREIGN KEY (VARINST1) 
  REFERENCES JBPM.JBPM_VARIABLEINSTANCE (ID) ;

ALTER TABLE JBPM_EXELOG ADD  CONSTRAINT FKB54EFE3CB58AFBE5
 FOREIGN KEY (VARINST2) 
  REFERENCES JBPM.JBPM_VARIABLEINSTANCE (ID) ;

ALTER TABLE JBPM_EXELOG ADD  CONSTRAINT FKB54EFE3CBAC048E9
 FOREIGN KEY (ACTION_) 
  REFERENCES JBPM.JBPM_ACTION (ID) ;

ALTER TABLE JBPM_INVOKELOG ADD  CONSTRAINT FKDDF9DD22696B9F9
 FOREIGN KEY (TOKEN) 
  REFERENCES JBPM.JBPM_TOKEN (ID) ;

ALTER TABLE JBPM_JOB ADD  CONSTRAINT FK375F5193696B9F9
 FOREIGN KEY (TOKEN) 
  REFERENCES JBPM.JBPM_TOKEN (ID) ;

ALTER TABLE JBPM_JOB ADD  CONSTRAINT FK375F51937E4E3BFE
 FOREIGN KEY (ACTIONDELEGATION) 
  REFERENCES JBPM.JBPM_DELEGATION (ID) ;

ALTER TABLE JBPM_JOB ADD  CONSTRAINT FK375F5193842C3824
 FOREIGN KEY (PROCESSINSTANCE) 
  REFERENCES JBPM.JBPM_PROCESSINSTANCE (ID) ;

ALTER TABLE JBPM_NODE ADD  CONSTRAINT FKB48CB2CC52D4AD28
 FOREIGN KEY (DELEGATION) 
  REFERENCES JBPM.JBPM_DELEGATION (ID) ;

ALTER TABLE JBPM_NODE ADD  CONSTRAINT FKB48CB2CCC3893553
 FOREIGN KEY (DEFINITION) 
  REFERENCES JBPM.JBPM_DEFINITION (ID) ;

ALTER TABLE JBPM_NODE ADD  CONSTRAINT FKB48CB2CCF41BD495
 FOREIGN KEY (CORRESPONDINGFORK) 
  REFERENCES JBPM.JBPM_NODE (ID) ;

ALTER TABLE JBPM_NODE ADD  CONSTRAINT FKB48CB2CCF41DA4FD
 FOREIGN KEY (CORRESPONDINGJOIN) 
  REFERENCES JBPM.JBPM_NODE (ID) ;

ALTER TABLE JBPM_NODE ADD  CONSTRAINT FKB48CB2CCFA8C2074
 FOREIGN KEY (SWIMLANE) 
  REFERENCES JBPM.JBPM_SWIMLANE (ID) ;

ALTER TABLE JBPM_PROCESSINSTANCE ADD  CONSTRAINT FK236E60DA3580E2
 FOREIGN KEY (ROOT) 
  REFERENCES JBPM.JBPM_TOKEN (ID) ;

ALTER TABLE JBPM_PROCESSINSTANCE ADD  CONSTRAINT FK236E60DA76CFBBE5
 FOREIGN KEY (SUPERPROCESSTOKEN) 
  REFERENCES JBPM.JBPM_TOKEN (ID) ;

ALTER TABLE JBPM_PROCESSINSTANCE ADD  CONSTRAINT FK236E60DAC3893553
 FOREIGN KEY (DEFINITION) 
  REFERENCES JBPM.JBPM_DEFINITION (ID) ;

ALTER TABLE JBPM_SWIMLANE ADD  CONSTRAINT FK1DD2A83E52D4AD28
 FOREIGN KEY (DELEGATION) 
  REFERENCES JBPM.JBPM_DELEGATION (ID) ;

ALTER TABLE JBPM_SWIMLANE ADD  CONSTRAINT FK1DD2A83EC3893553
 FOREIGN KEY (DEFINITION) 
  REFERENCES JBPM.JBPM_DEFINITION (ID) ;

ALTER TABLE JBPM_TOKEN ADD  CONSTRAINT FKDD5E4E4F68AC491
 FOREIGN KEY (STATE) 
  REFERENCES JBPM.JBPM_NODE (ID) ;

ALTER TABLE JBPM_TOKEN ADD  CONSTRAINT FKDD5E4E4F842C3824
 FOREIGN KEY (PROCESSINSTANCE) 
  REFERENCES JBPM.JBPM_PROCESSINSTANCE (ID) ;

ALTER TABLE JBPM_TOKEN ADD  CONSTRAINT FKDD5E4E4F96611053
 FOREIGN KEY (REACTIVATIONJOIN) 
  REFERENCES JBPM.JBPM_NODE (ID) ;

ALTER TABLE JBPM_TOKEN ADD  CONSTRAINT FKDD5E4E4FC4AB08AA
 FOREIGN KEY (PARENT) 
  REFERENCES JBPM.JBPM_TOKEN (ID) ;

ALTER TABLE JBPM_TOKEN ADD  CONSTRAINT FKDD5E4E4FCDC0E9C4
 FOREIGN KEY (SUBPROCESSINSTANCE) 
  REFERENCES JBPM.JBPM_PROCESSINSTANCE (ID) ;

ALTER TABLE JBPM_TOKEN ADD  CONSTRAINT FKDD5E4E4FE805D1A9
 FOREIGN KEY (LASTSTATELOG) 
  REFERENCES JBPM.JBPM_EXELOG (ID) ;

ALTER TABLE JBPM_TRANSITION ADD  CONSTRAINT FK4FF269F1C144
 FOREIGN KEY (TO_) 
  REFERENCES JBPM.JBPM_NODE (ID) ;

ALTER TABLE JBPM_TRANSITION ADD  CONSTRAINT FK4FF269F5D2DDF5
 FOREIGN KEY (FROM_) 
  REFERENCES JBPM.JBPM_NODE (ID) ;

ALTER TABLE JBPM_TRANSITION ADD  CONSTRAINT FK4FF269FC3893553
 FOREIGN KEY (DEFINITION) 
  REFERENCES JBPM.JBPM_DEFINITION (ID) ;

ALTER TABLE JBPM_TYPE ADD  CONSTRAINT FKB48F940452D4AD28
 FOREIGN KEY (DELEGATION) 
  REFERENCES JBPM.JBPM_DELEGATION (ID) ;

ALTER TABLE JBPM_TYPE ADD  CONSTRAINT FKB48F9404C3893553
 FOREIGN KEY (DEFINITION) 
  REFERENCES JBPM.JBPM_DEFINITION (ID) ;

ALTER TABLE JBPM_VARIABLE ADD  CONSTRAINT FKD8CB5A4669B5865
 FOREIGN KEY (TYPE_) 
  REFERENCES JBPM.JBPM_TYPE (ID) ;

ALTER TABLE JBPM_VARIABLE ADD  CONSTRAINT FKD8CB5A46C3893553
 FOREIGN KEY (DEFINITION) 
  REFERENCES JBPM.JBPM_DEFINITION (ID) ;

ALTER TABLE JBPM_VARIABLEINSTANCE ADD  CONSTRAINT FKC74438DB696B9F9
 FOREIGN KEY (TOKEN) 
  REFERENCES JBPM.JBPM_TOKEN (ID) ;

ALTER TABLE JBPM_VARIABLEINSTANCE ADD  CONSTRAINT FKC74438DB69B5865
 FOREIGN KEY (TYPE_) 
  REFERENCES JBPM.JBPM_TYPE (ID) ;

