grails / gorm-hibernate5

GORM for Hibernate 5
Apache License 2.0
66 stars 71 forks source link

Multi-tenancy not working with inheritance #11

Open satshil opened 7 years ago

satshil commented 7 years ago

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

satshil commented 7 years ago

I think I should have raised this on grails-data-mapping. Dont know how to transfer? Should I close this and raise another one on grails-data-mapping?