创建⼯作流的23张表
⽅式⼀:通过代码初始化⼯作流的23张表
/**
* 通过代码初始化⼯作流的23张表
*/
@Test
public void createActivitiTable(){
ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration
.createStandaloneProcessEngineConfiguration();
// 连接数控的配置
processEngineConfiguration.setJdbcDriver("sql.jdbc.Driver");
processEngineConfiguration.setJdbcUrl("jdbc:mysql://localhost:3306/acti?useUnicode=true&characterEncoding=utf8");
processEngineConfiguration.setJdbcUsername("root");
processEngineConfiguration.setJdbcPassword("jing2018");
/**
* DB_SCHEMA_UPDATE_FALSE = "false";不能⾃动创建表,需要表存在
* DB_SCHEMA_UPDATE_CREATE_DROP = "create-drop";先删除表再创建表
* DB_SCHEMA_UPDATE_TRUE = "true";如果表不存在,⾃动创建表
createprocessa*/
processEngineConfiguration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
// ProcessEngine(流程引擎),⼯作流的核⼼对象
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
System.out.println("processEngine:" + processEngine);
}
⽅式⼆:通过配置⽂件初始化
/**
* 使⽤配置⽂件创建⼯作流数据表
*/
@Test
public void createTableByConfig(){
ProcessEngine processEngine = ProcessEngineConfiguration
.createProcessEngineConfigurationFromResource("l").buildProcessEngine();
System.out.println("processEngine:"+processEngine);
}
配置⽂件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="/schema/beans"
xmlns:xsi="/2001/XMLSchema-instance"
xmlns:context="/schema/context"
xmlns:tx="/schema/tx"
xmlns:aop="/schema/aop"
xsi:schemaLocation="/schema/beans
/schema/beans/spring-beans-3.0.xsd
/schema/context
/schema/context/spring-context-3.0.xsd
/schema/tx
/schema/tx/spring-tx-3.0.xsd
/schema/aop
/schema/aop/spring-aop-3.0.xsd">
<bean id="processEngineConfiguration"
class="ine.impl.cfg.StandaloneProcessEngineConfiguration">
<!-- 连接数据的配置 -->
<property name="jdbcDriver"value="sql.jdbc.Driver" />
<property name="jdbcUrl"
value="jdbc:mysql://localhost:3306/acti?useUnicode=true&characterEncoding=utf8"/> <property name="jdbcUsername"value="root"/>
<property name="jdbcPassword"value="jing2018"/>
<!-- 没有表创建表 -->
<property name="databaseSchemaUpdate"value="true"/><!-- true、false、create-drop --> </bean>
</beans>
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论