使用配置文件创建工作流表
<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<!-- 连接数据库配置 -->
<property name="jdbcDriver" value="oracle.jdbc.driver.OracleDriver"></property>
<property name="jdbcUrl" value="jdbc:oracle:thin:@localhost:1521:orcl"></property>
<property name="jdbcUsername" value="activiti"></property>
<property name="jdbcPassword" value="activiti"></property>
<!-- 如果表不存在 自动创建 -->
<property name="databaseSchemaUpdate" value="true"></property>
</bean>
启动报如下错误:
### The error may exist in org/activiti/db/mapping/entity/Property.xml
### The error may involve org.activiti.engine.impl.persistence.entity.PropertyEntity.selectProperty-Inline
### The error occurred while setting parameters
### SQL: select * from ACT_GE_PROPERTY where NAME_ = ?
### Cause: java.sql.SQLException: ORA-00942: 表或视图不存在
原因是引擎在创建表之前 isTablePresent() 方法 发现 schema 的值为null,所以需要配置属性
<property name="databaseSchema" value="activiti"></property>
重新启动,成功创建表。再次启动又报错
Caused by: java.sql.SQLException: ORA-00955: 名称已由现有对象使用
将值改为 大写 即可
<property name="databaseSchema" value="ACTIVITI"></property>