jBPM持久化(以MySQL为例)

1、 在MySQL里新建一数据库,名为jbpm(create database jbpm;),名字可以任意,后面要用到。

2、找到下载的jbpm-starters-kit-3.1.4,找到其中的jbpm文件夹。

3、将MySQL的JDBC驱动mysql-connector.jar拷贝到jbpm文件夹的lib/mysql下,没有mysql文件夹则新建一个。

4、在jbpm文件夹的src/resources下新建文件夹mysql,将src/resources/hssqldb文件夹下的create.db.hibernate.properties和identity.db.xml文件拷贝到mysql目录下。

5、修改create.db.hibernate.properties文件,修改内容如下:

hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://localhost:3306/jbpm
hibernate.connection.username=root
hibernate.connection.password=123
hibernate.show_sql=true
6、找到jbpm/src/config.files/hibernate.cfg.xml,修改jdbc connection properties。内容如下:

<!-- jdbc connection properties -->
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/jbpm</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password">123</property>

7、在jbpm根目录下,打开build.deploy.xml文件,找到其中的create.db并修改如下:

 <!-- ============== -->
  <!-- === SERVER === -->
  <!-- ============== -->
  <target name="create.db" depends="declare.jbpm.tasks, db.clean, db.start" description="creates a hypersonic database with the jbpm tables and loads the processes in there">
    <jbpmschema actions="create"
                cfg="${basedir}/src/config.files/hibernate.cfg.xml"
                properties="${basedir}/src/resources/mysql /create.db.hibernate.properties"/>
    <loadidentities file="${basedir}/src/resources/mysql /identity.db.xml"
                cfg="${basedir}/src/config.files/hibernate.cfg.xml"
                properties="${basedir}/src/resources/mysql /create.db.hibernate.properties"/>
    <ant antfile="build.xml" target="build.processes" inheritall="false" />
    <deployprocess cfg="${basedir}/src/config.files/hibernate.cfg.xml"
                   properties="${basedir}/src/resources/mysql /create.db.hibernate.properties">
      <fileset dir="build" includes="*.process" />
    </deployprocess>
    <antcall target="db.stop" />
  </target>

8、在命令行下进入jbpm目录,利用ant工具建数据库(要求提前配制好ant环境变量)。ant create.db -buildfile build.deploy.xml。

9、打开MySQL Browser Query,就可看到jbpm数据库中一系列以JBPM_开头的表,表示建表成功。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值