亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

多租戶遷移以使用 quarkus

多租戶遷移以使用 quarkus

DIEA 2023-06-08 19:51:28
我正在努力遷移應用程序以使用最新版本的quarkus。該應用程序使用來自休眠接口的數據庫策略實現多租戶。Quarkus 建議(如果可能)避免使用persistence.xml ,在給定quarkus 上下文的情況下,這種多租戶情況的正確方法是什么?保留persistence.xml還是僅使用quarkus 推薦的application.properties ?@Singletonpublic class HibernateConnectionProviderFactory implements ConnectionProviderFactory {    private Logger logger = Logger.getLogger(getClass().getName());    private static final String TENANT_ID_PLACEHOLDER = "{tenant.id}";    @Inject    @SystemProperty("multitenant.hibernate.connection.url")    private Optional<String> dbUrl;    @Inject    @SystemProperty("multitenant.hibernate.connection.driver_class")    private Optional<String> dbDriverClass;    @Inject    @SystemProperty("multitenant.hibernate.dialect")    private Optional<String> dbDialect;    @Inject    @SystemProperty("multitenant.hibernate.connection.username")    private Optional<String> dbUsername;    @Inject    @SystemProperty("multitenant.hibernate.connection.password")    private Optional<String> dbPassword;    @Inject    @SystemProperty(value = "multitenant.hibernate.schema.generation", defaultValue = "false")    private boolean generateSchema;    @Inject    @SystemProperty("multitenant.default.tenant.id")    private Optional<String> defaultTenantId;    @Inject    private PersistenceUnitDescriptorFactory persistenceUnitDescriptorFactory;    @Inject    private SchemaGenerator schemaGenerator;    private final ConcurrentHashMap<String, ConnectionProvider> providers = new ConcurrentHashMap<>();    @Override    public Optional<ConnectionProvider> getDefaultConnectionProvider() {        return defaultTenantId.map(this::getConnectionProvider);    }    @Override    public ConnectionProvider getConnectionProvider(String tenantId) {        return providers.computeIfAbsent(tenantId, this::createDriverManagerConnectionProvider);    }
查看完整描述

1 回答

?
catspeake

TA貢獻1111條經驗 獲得超0個贊

現在我們不支持使用 Quarkus application.properties 設置 Hibernate ORM 多租戶,因此您應該采用 persistence.xml 方式。

話雖如此,如果有足夠的吸引力,我們可能會考慮在未來支持它。您能否在 GitHub 上提出問題,以便我們收集有關此功能的反饋?

謝謝!


查看完整回答
反對 回復 2023-06-08
  • 1 回答
  • 0 關注
  • 164 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號