为activiti-5.12.1表指定数据库模式

问题描述 投票:3回答:3

我将在我的项目中使用activiti-5.12.1。

这是activiti.cfg.xml文件:

<?xml version='1.0' encoding='UTF-8'?>

<beans xmlns="http://www.springframework.org/schema/beans" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration" >

        <property name="databaseType" value="postgres" />
        <property name="jdbcUrl" value="jdbc:postgresql://project:5432/MYPROJECT" />
        <property name="jdbcDriver" value="org.postgresql.Driver" />
        <property name="jdbcUsername" value="me" />
        <property name="jdbcPassword" value="you" />

        <property name="databaseSchemaUpdate" value="false" />

        <property name="jobExecutorActivate" value="false" />

        <property name="history" value="full" />

        <property name="customPreVariableTypes">
            <list>
                <ref bean="activitiScriptNodeType" />
                <ref bean="activitiScriptNodeListType" />
            </list>
        </property>


        <property name="mailServerHost" value="mail.my-corp.com" />
        <property name="mailServerPort" value="5025" />
    </bean>

</beans>

我想通过使用activiti-engine-5.12.1.jar中提供的脚本自己创建activiti数据库。 默认情况下,表是在公共模式中创建的,但我希望它们位于另一个模式中,例如mySchema。 我的问题是如何管理这个,另外,如何在activiti.cfg.xml中指定这个,以通知activiti引擎api,运行表在mySchema中?

postgresql activiti bpmn
3个回答
2
投票

我正在使用MySQL数据库为activiti,所以我有一些像这样的配置来创建我自己的架构名称:

<property name="databaseType" value="mysql" />
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/activiti" />
<property name="jdbcDriver" value="com.mysql.jdbc.Driver" />
<property name="jdbcUsername" value="root" />
<property name="jdbcPassword" value="root" />

因此,当您使用postgresql时,我不太确定以下代码是否适合您:

<?xml version='1.0' encoding='UTF-8'?>

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration" >

    <property name="databaseType" value="postgres" />
    <property name="jdbcUrl" value="jdbc:postgresql://project:5432/MYPROJECT/activiti" />
    <property name="jdbcDriver" value="org.postgresql.Driver" />
    <property name="jdbcUsername" value="me" />
    <property name="jdbcPassword" value="you" />

    <property name="databaseSchemaUpdate" value="false" />

    <property name="jobExecutorActivate" value="false" />

    <property name="history" value="full" />

    <property name="customPreVariableTypes">
        <list>
            <ref bean="activitiScriptNodeType" />
            <ref bean="activitiScriptNodeListType" />
        </list>
    </property>


    <property name="mailServerHost" value="mail.my-corp.com" />
    <property name="mailServerPort" value="5025" />
</bean>

在使用新更改部署`activiti之前,请确保您的数据库已创建架构。


1
投票

尝试将数据库的类型更改为数据库的名称或“postgresql”。


0
投票

如果您使用spring,则以下属性有助于:spring.activiti.databaseSchema = MY_SCHEMA

© www.soinside.com 2019 - 2024. All rights reserved.