Hibernate中的多租户 [英] Multi tenancy in Hibernate
问题描述
我尝试使用单独的模式方法将多租户添加到Java应用程序中,如此次网络研讨会
我想知道如何通过spring使用属性文件来配置多个数据源,并根据tenant id从Spring上下文获取数据源。
更重要的是,虽然我希望能够配置我的自定义连接提供程序实现,该实现支持此多租户功能,而不是使用默认情况下使用的injectconnectionprovider。
我该如何做到这一点。 使用 AbstractRoutingDataSource
。看到我的答案位于@ 当使用多个数据源时,Spring中的多个实体管理器问题。
I am trying to add multi tenancy to a java application using the separate schema approach as outlined in this webinar
I wanted to know how would i configure mulitple datasources via spring perhaps by using properties files and get the datasources from the spring context based on tenant id.
More importantly though i want to be able to configure my custom connection provider implementation that supports this multi-tenancy feature to be used by hibernate instead of the injectedconnectionprovider that it uses by default.
How can i achieve this.
Use the AbstractRoutingDataSource
. See my answer located @ Multiple Entity Manager issue in Spring when using more than one datasource.
这篇关于Hibernate中的多租户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!