activiti兼容达梦数据库
1、继承
SpringProcessEngineConfiguration
重写方法
initDatabaseType(){
Connection connection = null; try {connection = dataSource.getConnection();DatabaseMetaData databaseMetaData = connection.getMetaData();String databaseProductName = databaseMetaData.getDatabaseProductName();log.debug("database product name: '{}'", databaseProductName);if(databaseProductName.contains("DM DBMS")){databaseProductName="Oracle";}databaseType = databaseTypeMappings.getProperty(databaseProductName);if (databaseType==null) {throw new ActivitiException("couldn't deduct database type from database product name '"+databaseProductName+"'");}log.debug("using database type: {}", databaseType);} catch (SQLException e) {log.error("Exception while initializing Database connection", e); } finally {try {if (connection!=null) {connection.close();}} catch (SQLException e) {log.error("Exception while closing the Database connection", e);} }
}
2、修改activiti启动配置项
/ Copyright (c) 2018-2025, armycloud All rights reserved. Redistribution and use in source and binary forms, with or without* modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice,* this list of conditions and the following disclaimer.* Redistributions in binary form must reproduce the above copyright* notice, this list of conditions and the following disclaimer in the* documentation and/or other materials provided with the distribution.* Neither the name of the pig4cloud.com developer nor the names of its* contributors may be used to endorse or promote products derived from* this software without specific prior written permission.* Author: armycloud*/package com.sourcedance.armycloud.act.config;import lombok.AllArgsConstructor; import org.activiti.spring.SpringProcessEngineConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.core.task.TaskExecutor; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.transaction.PlatformTransactionManager;import javax.sql.DataSource;/* @author armycloud* @date 2018/9/25 Activiti 配置*/ @Configuration @AllArgsConstructor public class ActivitiConfiguration {private final DataSource dataSource;private final PlatformTransactionManager transactionManager;@Beanpublic SpringProcessEngineConfiguration getProcessEngineConfiguration() {SpringProcessEngineConfiguration config = new ProcessEngineConfigurationImpl();// 流程图字体设置config.setActivityFontName("宋体");config.setAnnotationFontName("宋体");config.setLabelFontName("黑体");config.setDataSource(dataSource);config.setTransactionManager(transactionManager);config.setDatabaseSchemaUpdate("true");return config;}@Bean@Primarypublic TaskExecutor primaryTaskExecutor() {return new ThreadPoolTaskExecutor();}}