What version of Grails to use for Multi Tenancy via Hibernate 4

327 views Asked by At

Is it possible to implement Multi Tenancy in Grails 2.3.6 with Hibernate 4? Or can it only be achieved (or is it more advisable) with Grails 3.x? Any documentation material on this will be appreciated.

1

There are 1 answers

3
Rotem On BEST ANSWER

The Grails 3.2.10 (last version) is not using the Multi tenancy mode by default. Nevertheless, GORM enables multi tenancy, when it is defined in the configuration. (GORM is the data access framework comes built in with Grails)

Here is a link to the GROM documentation. You can see to the YAML configuration file:

grails:
gorm:
    multiTenancy:
        mode: DATABASE
        tenantResolverClass: org.grails.datastore.mapping.multitenancy.web.SubDomainTenantResolver

GORM supports 3 different multitenancy modes:

DATABASE - A separate database with a separate connection pool is used to store each tenants data.

SCHEMA - The same database, but different schemas are used to store each tenants data.

DISCRIMINATOR - The same database is used with a discriminator used to partition and isolate data.

I hope that helps.

For more information please follow the documentation of configurating and mapping domain classes.