Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Hibernate 5 & Spring Boot multitenancy (schema per user)
PostPosted: Thu Mar 02, 2017 10:06 am 
Newbie

Joined: Thu Mar 02, 2017 9:59 am
Posts: 1
This question might be beyond the scope of Hibernate but I didn't get any other valuable inputs in other forums.

I'm building an application that should serve multiple users and store their very sensitive data. 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-user paradigm:

1. Upon registration, what is the proper way to create a new schema on the fly?

2. How do I handle login? should all the authentication-related tables be in a different main schema? how do I maintain foreign keys between the main schema and user's schema then?


Top
 Profile  
 
 Post subject: Re: Multi-tenancy in Hibernate5 (+Spring Boot) - Schema per user
PostPosted: Thu Mar 02, 2017 10:21 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1532
Location: Romania
Usually, each tenant represents a Customer, not a User. Each Customer can still have multiple Users to access their schema.

That being said, the registration process can create a schema using a dedicated database user that is allowed to create schemas.

Then, when the users log in, they need to provide the Customer Identifier which designates the associated database schema.

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.