I'm building an application that should serve multiple tenants and store their very sensitive data. Each tenant has multiple users. My backend stack is built with spring-boot + Hibernate5. I want hibernate to handle multi-tenancy so I have 2 questions for the experts:
- Providing I'm using schema-per-tenant paradigm, how do I associate a username to a tenant on login? Each tenant has it's own users table so how do I know to which tenant that username belongs?
- Upon registration, what is the proper way to create a new schema on the fly?