Chapter 4. Upgrading JBoss Portal 2.6 to Enterprise Portal Platform 4.3

Warning

Before performing any instructions or operations in this chapter, back up your database and the entire JBoss EAP directory!
Enterprise Portal Platform 4.3 compatibility with JBoss Portal 2.6 is very high. The main differences are the use of JSR-286 features to replace JBoss Portal specific features. The database schema has slightly changed though.

4.1. Schema update

Note

If you haven't used any workflow mechanism in JBoss Portal 2.6 and if the database user has the rights to alter/create tables in the running database, all the following changes will be automatically be done.
The columns SER_STATE of the table JBP_INSTANCE and SER_STATE of the table JBP_INSTANCE_PER_USER have changed from a length of 50000000 to 16384. You can either alter the tables or modify the hibernate mapping file portal-core-sar/conf/hibernate/instance/domain.hbm.xml to set back the length to 50000000 if your database allows it.
The major changes on the schema are related to JBpm as stated in the JBpm 3.2 release note. JBoss Portal 2.6 was using JBpm 3.1 while the Enterprise Portal Platform 4.3 is using JBpm 3.2. Here is the relevant part from the JBpm release note:

4.1.1. JBpm 3.2 release note extract

jPDL Database Schema Updates from 3.1.x to 3.2.x
create table JBPM_JOB (
  ID_ bigint generated by default as identity (start with 1), 
  CLASS_ char(1) not null, 
  VERSION_ integer not null, 
  DUEDATE_ timestamp, 
  PROCESSINSTANCE_ bigint, 
  TOKEN_ bigint, 
  TASKINSTANCE_ bigint, 
  ISSUSPENDED_ bit, 
  ISEXCLUSIVE_ bit, 
  LOCKOWNER_ varchar(255), 
  LOCKTIME_ timestamp, 
  EXCEPTION_ varchar(4000), 
  RETRIES_ integer, 
  NAME_ varchar(255), 
  REPEAT_ varchar(255),
  TRANSITIONNAME_ varchar(255), 
  ACTION_ bigint, 
  GRAPHELEMENTTYPE_ varchar(255), 
  GRAPHELEMENT_ bigint, 
  NODE_ bigint, 
  primary key (ID_)
)

alter table JBPM_MODULEINSTANCE add column VERSION_ integer
alter table JBPM_NODE add column DESCRIPTION_ varchar(4000)
alter table JBPM_NODE add column ISASYNCEXCL_ bit
alter table JBPM_NODE add column SUBPROCNAME_ varchar(255)
alter table JBPM_NODE add column SCRIPT_ bigint
alter table JBPM_POOLEDACTOR add column VERSION_ integer
alter table JBPM_PROCESSDEFINITION add column CLASS_ char(1)
alter table JBPM_PROCESSDEFINITION add column DESCRIPTION_ varchar(4000)
alter table JBPM_PROCESSINSTANCE add column KEY_ varchar(255)
alter table JBPM_SWIMLANEINSTANCE add column VERSION_ integer
alter table JBPM_TASK add column CONDITION_ varchar(255)
alter table JBPM_TASK add column PRIORITY_ integer
alter table JBPM_TASKINSTANCE add column VERSION_ integer
alter table JBPM_TASKINSTANCE add column PROCINST_ bigint
alter table JBPM_TOKEN add column LOCK_ varchar(255)
alter table JBPM_TOKENVARIABLEMAP add column VERSION_ integer
alter table JBPM_TRANSITION add column DESCRIPTION_ varchar(4000)
alter table JBPM_TRANSITION add column CONDITION_ varchar(255)
alter table JBPM_VARIABLEINSTANCE add column VERSION_ integer
alter table JBPM_JOB add constraint FK_JOB_TOKEN foreign key (TOKEN_) references JBPM_TOKEN
alter table JBPM_JOB add constraint FK_JOB_NODE foreign key (NODE_) references JBPM_NODE
alter table JBPM_JOB add constraint FK_JOB_PRINST foreign key (PROCESSINSTANCE_) references JBPM_PROCESSINSTANCE
alter table JBPM_JOB add constraint FK_JOB_ACTION foreign key (ACTION_) references JBPM_ACTION
alter table JBPM_JOB add constraint FK_JOB_TSKINST foreign key (TASKINSTANCE_) references JBPM_TASKINSTANCE
alter table JBPM_NODE add constraint FK_NODE_SCRIPT foreign key (SCRIPT_) references JBPM_ACTION
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_TSKINS_PRCINS foreign key (PROCINST_) references JBPM_PROCESSINSTANCE
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_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

insert into JBPM_JOB
    (ID_,
    CLASS_,
    VERSION_,
    DUEDATE_,
    PROCESSINSTANCE_,
    TOKEN_,
    TASKINSTANCE_,
    ISSUSPENDED_,
    ISEXCLUSIVE_,
    LOCKOWNER_,
    LOCKTIME_,
    EXCEPTION_,
    RETRIES_,
    NAME_,
    REPEAT_,
    TRANSITIONNAME_,
    ACTION_,
    GRAPHELEMENTTYPE_,
    GRAPHELEMENT_)
select
    ID_,
    'T',
    0,
    DUEDATE_,
    PROCESSINSTANCE_,
    TOKEN_,
    TASKINSTANCE_,
    ISSUSPENDED_,
    0,
    NULL,
    NULL,
    EXCEPTION_,
    0,
    NAME_,
    REPEAT_,
    TRANSITIONNAME_,
    ACTION_,
    GRAPHELEMENTTYPE_,
    GRAPHELEMENT_
from JBPM_TIMER;

drop table JBPM_MESSAGE
Since, 3.2, the table JBPM_DECISIONCONDITION is not used any more. But it is still in the default generated schema because of backwards compatibility reasons. Newly deployed processes (even if they have decision conditions) will not use that table any more. So if your old processes don't have decision conditions or if you only deploy new processes to your db, you can safely drop the JBPM_DECISIONCONDITION table. If you do that, don't forget to remove the line that refers to the decision condition class in your hibernate.cfg.xml and also remove the decisionConditions list entry in the org/jbpm/graph/node/Decision.hbm.xml file.