是否有Hibernate Multi租赁更新所有数据库的配置?

时间:2015-05-22 12:37:50

标签: hibernate multi-tenant

我使用多租户的Hibernate并且在更改类时发现问题,例如新属性,当我启动Wildfly服务器时,只更新默认数据库,这是一种配置hibernate更新的方法所有数据库?

按照我的entityManagerFacotory配置:

<bean depends-on="dataSource" id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="jpaVendorAdapter">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
            <property name="databasePlatform" value="org.hibernate.dialect.SQLServerDialect" />
            <property name="showSql" value="true" />
        </bean>
    </property>
    <property name="packagesToScan" value="xx.xxx.xxxxxx.xxx" />
    <property name="persistenceUnitName" value="TesteJpa" />
    <property name="dataSource" ref="dataSource" />
    <property name="jpaProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
            <prop key="hibernate.hbm2ddl.auto">update</prop>
            <prop key="hibernate.multiTenancy">DATABASE</prop>
            <prop key="hibernate.tenant_identifier_resolver">xx.xxx.xxxxx.routingds.SchemaResolver</prop>
            <prop key="hibernate.multi_tenant_connection_provider">xx.xxx.xxxxxx.routingds.MultiTenantProvider</prop>
            <prop key="hibernate.search.suseIndex.directory_provider">filesystem</prop>
            <prop key="hibernate.search.suseIndex.indexBase">C:\xxx\indexes</prop>
        </props>
    </property>
</bean> 

我尝试了属性hibernate.hbm2ddl.auto = update,但这似乎不起作用,并生成错误:无法完成架构更新:java.lang.NullPointerException。

有什么建议吗?

0 个答案:

没有答案