apache / apache/grails-core

Multi-tenancy not working with inheritance

Open
#14,478 1 comment 0 reactions 0 assignees View on GitHub
relates-to: grails-data-hibernate5
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

Scenario
===================
Grails 3.1.10
gorm 6.0.0
jdk 1.8

Multitenant application with 3 tenants
1. default (masterdata)
2. test-one
3. test-two

Classes with nature of inheritance
1. user (abstract base class) (tenant 2,3)
2. person (child of user) (tenant 2,3)
3. institute (child of user) (tenant 2,3)
4. employee (child of person) (tenant 2,3)
5. superEmployee (child of employee) (tenant 3)

Issues
============
I found two issues.

1. I defined datasources mapping properties for the multi-tenant classes. datasources (['test-one','test-two']) defined.
Expected : Tables created only under test-one and test-two.
Actual : tables created under dataScource, teat-one and test-two

2. Child class superEmployee is not defined as multi-tenant. datasource 'test-two' defined.
Expected : table created only under tenant test-two
actual : table created under all tenants

Please find test application attached for your reference.

[test1.zip](https://github.com/grails/gorm-hibernate5/files/587676/test1.zip)

Contributor guide

Open the contributing guide

Research direction

Start by running the attached test1.zip application with Grails 3.1.10, GORM 6.0.0, and JDK 1.8, then inspect its multi-tenant datasource mappings and inherited classes. Reproduce both reported cases and compare the created tables with the expected tenant-specific placement.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.