ofbiz 分开默认数据库

1 web.xml

<context-param>
    <param-name>entityDelegatorName</param-name>
    <param-value>default</param-value>
    <description>The Name of the Entity Delegator to use, defined in entityengine.xml</description>
</context-param>

在default 改自己定义的Delegator??oeasy

2 entityengine.xml自定义Delegator??oeasy

<delegator name="oeasy" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">
    <group-map group-name="org.ofbiz" datasource-name="ofbiz_mysql"/>
    <group-map group-name="org.ofbiz.olap" datasource-name="ofbiz_mysql"/>
    <group-map group-name="org.ofbiz.tenant" datasource-name="ofbiz_mysql"/>
</delegator>

3 定义个数据原 ofbiz_mysql

<datasource name="ofbiz_mysql"
        helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
        field-type-name="mysql"
        check-on-start="true"
        add-missing-on-start="true"
        check-pks-on-start="false"
        use-foreign-keys="true"
        join-style="ansi-no-parenthesis"
        alias-view-columns="false"
        drop-fk-use-foreign-key-keyword="true"
        table-type="InnoDB"
        character-set="utf8"
        collate="utf8_general_ci">
    <read-data reader-name="tenant"/>
    <read-data reader-name="seed"/>
    <read-data reader-name="seed-initial"/>
    <read-data reader-name="demo"/>
    <read-data reader-name="ext"/>
    <read-data reader-name="ext-test"/>
    <read-data reader-name="ext-demo"/>
    <inline-jdbc
            jdbc-driver="com.mysql.jdbc.Driver"
            jdbc-uri="jdbc:mysql://localhost/aa?autoReconnect=true"
            jdbc-username="root"
            jdbc-password="123456"
            isolation-level="ReadCommitted"
            pool-minsize="2"
            pool-maxsize="250"
            time-between-eviction-runs-millis="600000"/><!-- Please note that at least one person has experienced a problem with this value with MySQL
            and had to set it to -1 in order to avoid this issue.
            For more look at http://markmail.org/thread/5sivpykv7xkl66px and http://commons.apache.org/dbcp/configuration.html-->
    <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> -->
</datasource>

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。