Skip to content

Seed for achieving multi-tenancy (single pooled schema-per-tenant) using SpringBoot and Hibernate

Notifications You must be signed in to change notification settings

joao-bonin/springboot-schema-per-tenant

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

springboot-schema-per-tenant

Seed project for achieving multi-tenancy (single pooled schema-per-tenant) using SpringBoot and Hibernate as proposed in this article.

This project assumes a dedicated MySql DB is reachable (can be configured in application.properties), which has a default schema named default_schema and at least one additional schema with some tenant name you choose.

The default schema has a single table called user_tenant_relation and has the following structure:

CREATE TABLE `user_tenant_relation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(45) NOT NULL,
  `tenant` varchar(45) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username_tenent_uq` (`username`,`tenant`)
);

The JWT boiler-plate code is removed from to keep it clear and as simple as possible.

About

Seed for achieving multi-tenancy (single pooled schema-per-tenant) using SpringBoot and Hibernate

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 57.8%
  • Shell 24.7%
  • Batchfile 17.5%