How to manage many schemas on one database using h

2019-07-10 07:33发布

I have one database that has many schemas, one per client. We want to create a web application to be access online by the clients, the application should get the schema on runtime, I think in use Springframework and Hibernate to access the database. It's possible to use hibernate to make this works? Exist another framework for this?

1条回答
放我归山
2楼-- · 2019-07-10 07:53

Hibernate gets all JDBC connections from a connection factory, and this connection factory settings determine the DB schema against which all Hibernate queries/updates are issued. You can configure your application with multiple SessionFactory instances, each with a connection factory pointing to a different database schema. Then at runtime, you can pick one the appropriate SessionFactory to work with.

A simpler solution would be to run multiple copies of your web application, one for each client.

查看更多
登录 后发表回答