【问题标题】:specify a database schema for activiti-5.12.1 tables为 activiti-5.12.1 表指定数据库模式
【发布时间】:2013-05-15 10:41:34
【问题描述】:

我将在我的项目中使用 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 数据库,使用 activiti-engine-5.12.1.jar 中提供的脚本。
默认情况下,这些表是在 公共架构 中创建的,但我希望它们位于另一个架构中,例如 mySchema
我的问题是如何管理这个,此外,我如何在 activiti.cfg.xml 中指定这个,以通知 activiti 引擎 api activiti 表在 mySchema 中?

【问题讨论】:

    标签: postgresql activiti bpmn


    【解决方案1】:

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

    <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 之前,请确保您的数据库已创建架构。

    【讨论】:

      【解决方案2】:

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

      【讨论】:

      • databaseType 将是“postgres”(在 Activiti 5.18.0 中) - 但您不需要设置它,它将从 JDBC URL 派生。但遗憾的是,Activiti 对 PostgreSQL 的支持并不完美。
      【解决方案3】:

      如果您使用的是 spring,则以下属性会有所帮助: spring.activiti.databaseSchema=MY_SCHEMA

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-31
        • 1970-01-01
        • 2014-02-19
        • 2015-01-09
        相关资源
        最近更新 更多