[jboss-user] [JBoss jBPM] - Re: change database

crussell42 do-not-reply at jboss.com
Tue Feb 6 11:09:44 EST 2007


Two issues here 
1. changing db for 3.2.beta1. Assuming you want to change the jbpm-enterprise.ear you can expand the ear and change hibernate.cfg.cml. Here is a ant build script I created to expand the ear, edit the config files then recreate the ear. 
So "ant expand", edit expand/lib/jbpm-configs-jar/hibernate.cfg.xml, "ant build","ant deploy"

  | <project name="hpfm-jbpm">
  |   <property name="basedir" value="."/>
  |   <property name="built.dir" value="${basedir}/built"/>
  |   <property name="expand.dir" value="${basedir}/expand"/>
  |   <property name="jboss.deploy.dir" value="/usr/local/jboss/server/messaging/deploy"/>
  |   <target name="clean">
  |     <delete dir="${built.dir}" />
  |   </target>
  |   <target name="prepare">
  |     <mkdir dir="${built.dir}" />
  |     <mkdir dir="${expand.dir}" />
  |   </target>
  | 
  |   <target name="expand" description="expand ear into the expand dir" depends="prepare">
  |     <!-- UNZIP THE EAR FILE -->
  |     <unzip src="${basedir}/jbpm-enterprise.ear" dest="${expand.dir}" />
  | 
  |     <mkdir dir="${expand.dir}/jbpm-console-war" />
  |     <unzip src="${expand.dir}/jbpm-console.war" dest="${expand.dir}/jbpm-console-war" />
  | 
  |     <mkdir dir="${expand.dir}/jbpm-enterprise-jar" />
  |     <unzip src="${expand.dir}/jbpm-enterprise.jar" dest="${expand.dir}/jbpm-enterprise-jar" />
  | 
  |     <mkdir dir="${expand.dir}/lib/jbpm-configs-jar" />
  |     <unzip src="${expand.dir}/lib/jbpm-configs.jar" dest="${expand.dir}/lib/jbpm-configs-jar" />
  | 
  |     <mkdir dir="${expand.dir}/lib/jbpm-identity-jar" />
  |     <unzip src="${expand.dir}/lib/jbpm-identity.jar" dest="${expand.dir}/lib/jbpm-identity-jar" />
  | 
  |     <mkdir dir="${expand.dir}/lib/jbpm-jpdl-jar" />
  |     <unzip src="${expand.dir}/lib/jbpm-jpdl.jar" dest="${expand.dir}/lib/jbpm-jpdl-jar" />
  | 
  |   </target>    
  | 
  | 
  | 
  |   <target name="contract" description="remake all the parts to the parts directory" depends="prepare">
  | 
  |     <!-- ZIP CONTENTS OF THE EXPAND/LIB DIRECTORY-->
  | 
  |     <zip destfile="${expand.dir}/lib/jbpm-jpdl.jar">
  |       <fileset dir="${expand.dir}/lib/jbpm-jpdl-jar" />
  |     </zip>
  | 
  |     <zip destfile="${expand.dir}/lib/jbpm-identity.jar">
  |       <fileset dir="${expand.dir}/lib/jbpm-identity-jar" />
  |     </zip>
  | 
  |     <zip destfile="${expand.dir}/lib/jbpm-configs.jar">
  |       <fileset dir="${expand.dir}/lib/jbpm-configs-jar" />
  |     </zip>
  | 
  |     <!-- ZIP CONTENTS OF THE EXPAND DIRECTORY-->
  | 
  |     <zip destfile="${expand.dir}/jbpm-enterprise.jar">
  |       <fileset dir="${expand.dir}/jbpm-enterprise-jar" />
  |     </zip>
  | 
  |     <zip destfile="${expand.dir}/jbpm-console.war">
  |       <fileset dir="${expand.dir}/jbpm-console-war" />
  |     </zip>
  | 
  |   </target>
  | 
  |   
  | 
  | <!--
  |   <target name="build" depends="prepare, make-parts">
  |     <ear destfile="${built.dir}/jbpm-enterprise.ear" appxml="${parts.dir}/META-INF/application.xml">
  |       <fileset dir="${parts.dir}">
  |         <exclude name="META-INF/application.xml" />
  |       </fileset>
  |     </ear>
  |   </target>
  |   -->
  | 
  |   <target name="build" depends="prepare, contract">
  |     <ear destfile="${built.dir}/jbpm-enterprise.ear" appxml="${expand.dir}/META-INF/application.xml">
  |       <fileset dir="${expand.dir}" includes="*.war,*.jar,lib/*.jar" >
  |         <!--
  |         <exclude name="META-INF/application.xml" />
  |         <exclude name="jbpm-enterprise-jar" />
  |         <exclude name="jbpm-console-war" />
  |         <exclude name="lib/jbpm-identity-jar" />
  |         <exclude name="lib/jbpm-configs-jar" />
  |         <exclude name="lib/jbpm-jpdl-jar" />
  |         -->
  | 
  |       </fileset>
  |     </ear>
  |   </target>
  | 
  | 
  |   <target name="deploy" depends="build">
  |     <copy file="${built.dir}/jbpm-enterprise.ear" todir="${jboss.deploy.dir}"/>
  |   </target>
  | 
  | 
  | </project>
  | 
  | 

2. Create and populate the identity tables

  | create table JBPM_ID_GROUP (ID_ bigint generated by default as identity (start with 1), CLASS_ char(
  | 1) not null, NAME_ varchar(255), TYPE_ varchar(255), PARENT_ bigint, primary key (ID_));
  | create table JBPM_ID_MEMBERSHIP (ID_ bigint generated by default as identity (start with 1), CLASS_ 
  | char(1) not null, NAME_ varchar(255), ROLE_ varchar(255), USER_ bigint, GROUP_ bigint, primary key (
  | ID_));
  | create table JBPM_ID_PERMISSIONS (ENTITY_ bigint not null, CLASS_ varchar(255), NAME_ varchar(255), 
  | ACTION_ varchar(255));
  | create table JBPM_ID_USER (ID_ bigint generated by default as identity (start with 1), CLASS_ char(1
  | ) not null, NAME_ varchar(255), EMAIL_ varchar(255), PASSWORD_ varchar(255), primary key (ID_));
  | 
  | alter table JBPM_ID_GROUP add constraint FK_ID_GRP_PARENT foreign key (PARENT_) references JBPM_ID_G
  | ROUP;
  | 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;
  | 
  | 
  | 
  | INSERT INTO JBPM_ID_GROUP VALUES(1,'G','participant','security-role',NULL)
  | INSERT INTO JBPM_ID_GROUP VALUES(2,'G','administrator','security-role',NULL)
  | INSERT INTO JBPM_ID_GROUP VALUES(3,'G','hr','organisation',NULL)
  | INSERT INTO JBPM_ID_GROUP VALUES(4,'G','sales','organisation',NULL)
  | INSERT INTO JBPM_ID_GROUP VALUES(5,'G','manager','security-role',NULL)
  | INSERT INTO JBPM_ID_MEMBERSHIP VALUES(1,'M',NULL,NULL,2,2)
  | INSERT INTO JBPM_ID_MEMBERSHIP VALUES(2,'M',NULL,NULL,3,1)
  | INSERT INTO JBPM_ID_MEMBERSHIP VALUES(3,'M',NULL,NULL,3,3)
  | INSERT INTO JBPM_ID_MEMBERSHIP VALUES(4,'M',NULL,NULL,2,3)
  | INSERT INTO JBPM_ID_MEMBERSHIP VALUES(5,'M',NULL,NULL,1,4)
  | INSERT INTO JBPM_ID_MEMBERSHIP VALUES(6,'M',NULL,'boss',2,4)
  | INSERT INTO JBPM_ID_MEMBERSHIP VALUES(7,'M',NULL,NULL,2,5)
  | INSERT INTO JBPM_ID_MEMBERSHIP VALUES(8,'M',NULL,NULL,2,1)
  | INSERT INTO JBPM_ID_MEMBERSHIP VALUES(9,'M',NULL,NULL,1,1)
  | INSERT INTO JBPM_ID_USER VALUES(1,'U','cookie monster','cookie.monster at sesamestreet.tv','cookie mons
  | ter')
  | INSERT INTO JBPM_ID_USER VALUES(2,'U','ernie','ernie at sesamestreet.tv','ernie')
  | INSERT INTO JBPM_ID_USER VALUES(3,'U','bert','bert at sesamestreet.tv','bert')
  | INSERT INTO JBPM_ID_USER VALUES(4,'U','grover','grover at sesamestreet.tv','grover')
  | 
  | insert into JBPM_ID_USER (ID_, CLASS_, NAME_, EMAIL_, PASSWORD_) 
  |        values ('1', 'U', 'cookie monster', 'cookie.monster at sesamestreet.tv', 'cookie monster');
  | insert into JBPM_ID_USER (ID_,CLASS_, NAME_, EMAIL_, PASSWORD_) 
  |        values ('2', 'U', 'ernie', 'ernie at sesamestreet.tv', 'ernie');
  | insert into JBPM_ID_USER (ID_,CLASS_, NAME_, EMAIL_, PASSWORD_) 
  |        values ('3', 'U', 'bert', 'bert at sesamestreet.tv', 'bert');
  | insert into JBPM_ID_USER (ID_,CLASS_, NAME_, EMAIL_, PASSWORD_) 
  |        values ('4', 'U', 'grover', 'grover at sesamestreet.tv', 'grover');
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4011993#4011993

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4011993



More information about the jboss-user mailing list