help please, problems with gorm and MultiTenancy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

help please, problems with gorm and MultiTenancy

José Vilmar Estácio de Souza

Hi all.


I'm trying to create a simple application to test the multiTenancy mode since I need to convert an old app to grails 3.3.


In grails-app/conf/application.yml  I've the following declaration:
    gorm:
        multiTenancy:
            mode: DATABASE
            tenantResolverClass: mt.OrganizacaoTenantResolver

I created the following service:

@CurrentTenant
class T1Service {

    def list() {
def l = Plan.findAll()
return l
    }
This works perfectly using the correct tenant id returned by the TenantResolver implementation.

If i change the line 
def l = Plan.findAll()
to
def l = Plan.findAll { id > 0 }

gorm uses the default connection instead of the tenantId returned by the TenantResolver implementation

Am I doing something wrong?
Thanks.

}
Assinatura Informal José Vilmar, Telefones: 21 2555-2650 e 21 98868-0859,
        Skype: jvilmar

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/a6c00042-b280-d4cc-22f8-cf811522fd03%40informal.com.br.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help please, problems with gorm and MultiTenancy

Sergio del Amo Caballero
Hello José, 

If you could create a sample project which reproduces the issue, I would suggest creating an issue here:

https://github.com/grails/grails-core/issues

thanks,
Sergio del Amo

On Tuesday, 3 October 2017 17:22:59 UTC+2, José Vilmar Estácio de Souza wrote:

Hi all.


I'm trying to create a simple application to test the multiTenancy mode since I need to convert an old app to grails 3.3.


In grails-app/conf/application.yml  I've the following declaration:
    gorm:
        multiTenancy:
            mode: DATABASE
            tenantResolverClass: mt.OrganizacaoTenantResolver

I created the following service:

@CurrentTenant
class T1Service {

    def list() {
def l = Plan.findAll()
return l
    }
This works perfectly using the correct tenant id returned by the TenantResolver implementation.

If i change the line 
def l = Plan.findAll()
to
def l = Plan.findAll { id > 0 }

gorm uses the default connection instead of the tenantId returned by the TenantResolver implementation

Am I doing something wrong?
Thanks.

}
José Vilmar, Telefones: 21 2555-2650 e 21 98868-0859,
        Skype: jvilmar

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/35d06ea9-14f3-4709-930b-b800149fdf8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help please, problems with gorm and MultiTenancy

José Vilmar Estácio de Souza
Hello Sergio.

I'll do it.

My test was based in your guideConfigure Datasources dynamically while using DATABASE
Multi-tenancy.  http://guides.grails.org/grails-dynamic-multiple-datasources/guide/index.html?utm_campaign=Groovy%2BCalamari&utm_medium=email&utm_source=Groovy_Calamari98

Thanks for your help and your guide.

On 10/04/2017 06:12 AM, Sergio del Amo Caballero wrote:
Hello José, 

If you could create a sample project which reproduces the issue, I would suggest creating an issue here:


thanks,
Sergio del Amo

On Tuesday, 3 October 2017 17:22:59 UTC+2, José Vilmar Estácio de Souza wrote:

Hi all.


I'm trying to create a simple application to test the multiTenancy mode since I need to convert an old app to grails 3.3.


In grails-app/conf/application.yml  I've the following declaration:
    gorm:
        multiTenancy:
            mode: DATABASE
            tenantResolverClass: mt.OrganizacaoTenantResolver

I created the following service:

@CurrentTenant
class T1Service {

    def list() {
def l = Plan.findAll()
return l
    }
This works perfectly using the correct tenant id returned by the TenantResolver implementation.

If i change the line 
def l = Plan.findAll()
to
def l = Plan.findAll { id > 0 }

gorm uses the default connection instead of the tenantId returned by the TenantResolver implementation

Am I doing something wrong?
Thanks.

}
José Vilmar, Telefones: 21 2555-2650 e 21
                  98868-0859, Skype: jvilmar
--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/35d06ea9-14f3-4709-930b-b800149fdf8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Assinatura Informal José Vilmar, Telefones: 21 2555-2650 e 21 98868-0859,
        Skype: jvilmar

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/100eef9c-c444-c267-020a-9c80fd5386e3%40informal.com.br.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help please, problems with gorm and MultiTenancy

José Vilmar Estácio de Souza
In reply to this post by Sergio del Amo Caballero

Issue created at https://github.com/grails/grails-core/issues/10825.

This is my first issue, I hope that it was done in the correct way.

I hope that this can be fixed soon because I need to convert an app from grails 2.3.11 to grails 3.3.1 and the app needs to access multiple databases.

Thanks.



On 10/04/2017 06:12 AM, Sergio del Amo Caballero wrote:
Hello José, 

If you could create a sample project which reproduces the issue, I would suggest creating an issue here:


thanks,
Sergio del Amo

On Tuesday, 3 October 2017 17:22:59 UTC+2, José Vilmar Estácio de Souza wrote:

Hi all.


I'm trying to create a simple application to test the multiTenancy mode since I need to convert an old app to grails 3.3.


In grails-app/conf/application.yml  I've the following declaration:
    gorm:
        multiTenancy:
            mode: DATABASE
            tenantResolverClass: mt.OrganizacaoTenantResolver

I created the following service:

@CurrentTenant
class T1Service {

    def list() {
def l = Plan.findAll()
return l
    }
This works perfectly using the correct tenant id returned by the TenantResolver implementation.

If i change the line 
def l = Plan.findAll()
to
def l = Plan.findAll { id > 0 }

gorm uses the default connection instead of the tenantId returned by the TenantResolver implementation

Am I doing something wrong?
Thanks.

}
José Vilmar, Telefones: 21 2555-2650 e 21
                  98868-0859, Skype: jvilmar
--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/35d06ea9-14f3-4709-930b-b800149fdf8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Assinatura Informal José Vilmar, Telefones: 21 2555-2650 e 21 98868-0859,
        Skype: jvilmar

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/efe1b9a0-1cd2-cccd-a989-98c8a1aff464%40informal.com.br.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help please, problems with gorm and MultiTenancy

Sergio del Amo Caballero
To access multiple-databases you don’t need multi-tenancy features but multi-datasource features.

http://gorm.grails.org/latest/hibernate/manual/index.html#multipleDataSources


> On 5 Oct 2017, at 12:09, José Vilmar Estácio de Souza <[hidden email]> wrote:
>
> Issue created at https://github.com/grails/grails-core/issues/10825.
>
> This is my first issue, I hope that it was done in the correct way.
>
> I hope that this can be fixed soon because I need to convert an app from grails 2.3.11 to grails 3.3.1 and the app needs to access multiple databases.
> Thanks.
>
>
>
> On 10/04/2017 06:12 AM, Sergio del Amo Caballero wrote:
>> Hello José,
>>
>> If you could create a sample project which reproduces the issue, I would suggest creating an issue here:
>>
>> https://github.com/grails/grails-core/issues
>>
>> thanks,
>> Sergio del Amo
>>
>> On Tuesday, 3 October 2017 17:22:59 UTC+2, José Vilmar Estácio de Souza wrote:
>> Hi all.
>>
>>
>> I'm trying to create a simple application to test the multiTenancy mode since I need to convert an old app to grails 3.3.
>>
>>
>> In grails-app/conf/application.yml  I've the following declaration:
>>     gorm:
>>         multiTenancy:
>>             mode: DATABASE
>>             tenantResolverClass: mt.OrganizacaoTenantResolver
>>
>> I created the following service:
>>
>> @CurrentTenant
>> class T1Service {
>>
>>     def list() {
>> def l = Plan.findAll()
>> return l
>>     }
>> This works perfectly using the correct tenant id returned by the TenantResolver implementation.
>>
>> If i change the line  
>> def l = Plan.findAll()
>> to
>> def l = Plan.findAll { id > 0 }
>>
>> gorm uses the default connection instead of the tenantId returned by the TenantResolver implementation
>>
>> Am I doing something wrong?
>> Thanks.
>>
>> }
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
>> To post to this group, send email to [hidden email].
>> To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/35d06ea9-14f3-4709-930b-b800149fdf8f%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
>

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/EF848F1E-5E71-4145-B783-8C301082ECD6%40softamo.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: help please, problems with gorm and MultiTenancy

José Vilmar Estácio de Souza

The problem is that new clients can be added while the application is active and each client has its own database. A scenario similar to what was shown in the following link:


http://guides.grails.org/grails-dynamic-multiple-datasources/guide/index.html?utm_campaign=Groovy%2BCalamari&utm_medium=email&utm_source=Groovy_Calamari98


On 10/05/2017 07:11 AM, Sergio del Amo Caballero wrote:
To access multiple-databases you don’t need multi-tenancy features but multi-datasource features. 

http://gorm.grails.org/latest/hibernate/manual/index.html#multipleDataSources


On 5 Oct 2017, at 12:09, José Vilmar Estácio de Souza [hidden email] wrote:

Issue created at https://github.com/grails/grails-core/issues/10825.

This is my first issue, I hope that it was done in the correct way.

I hope that this can be fixed soon because I need to convert an app from grails 2.3.11 to grails 3.3.1 and the app needs to access multiple databases.
Thanks.



On 10/04/2017 06:12 AM, Sergio del Amo Caballero wrote:
Hello José, 

If you could create a sample project which reproduces the issue, I would suggest creating an issue here:

https://github.com/grails/grails-core/issues

thanks,
Sergio del Amo

On Tuesday, 3 October 2017 17:22:59 UTC+2, José Vilmar Estácio de Souza wrote:
Hi all.


I'm trying to create a simple application to test the multiTenancy mode since I need to convert an old app to grails 3.3.


In grails-app/conf/application.yml  I've the following declaration:
    gorm:
        multiTenancy:
            mode: DATABASE
            tenantResolverClass: mt.OrganizacaoTenantResolver

I created the following service:

@CurrentTenant
class T1Service {

    def list() {
def l = Plan.findAll()
return l
    }
This works perfectly using the correct tenant id returned by the TenantResolver implementation.

If i change the line  
def l = Plan.findAll()
to 
def l = Plan.findAll { id > 0 }

gorm uses the default connection instead of the tenantId returned by the TenantResolver implementation

Am I doing something wrong?
Thanks.

}

-- 
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/35d06ea9-14f3-4709-930b-b800149fdf8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- 


    

--
Assinatura Informal José Vilmar, Telefones: 21 2555-2650 e 21 98868-0859,
        Skype: jvilmar

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/891702c5-dcd6-18bd-4a1f-885f97871510%40informal.com.br.
For more options, visit https://groups.google.com/d/optout.