且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Hibernate多租户 - 自动创建表

更新时间:2023-02-03 15:40:29

如果您使用的是Spring(基于您的问题,听起来就像您一样),您可以使用 AbstractRoutingDataSource 。看到我对这个问题的回答:多个实体管理器在使用多个数据源时出现在Spring中。

If you are using Spring (based on your question, it sounds like you are), you can use the AbstractRoutingDataSource. See my answer on this issue: Multiple Entity Manager issue in Spring when using more than one datasource.