Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Cacheable annotation doesn't work with @CurrentTenant #56

Open
dpcasady opened this issue Oct 15, 2018 · 1 comment
Open

@Cacheable annotation doesn't work with @CurrentTenant #56

dpcasady opened this issue Oct 15, 2018 · 1 comment

Comments

@dpcasady
Copy link

dpcasady commented Oct 15, 2018

Given a simple service class annotated with @CurrentTenant:

@CurrentTenant
@Transactional(readOnly = true)
class MultiTenantCachingService {

    @Cacheable('test')
    def serviceMethod() {

    }
}

Calling serviceMethod() throws the following exception:

No such property: tenantId for class: org.grails.MultiTenantCachingService
groovy.lang.MissingPropertyException: No such property: tenantId for class: org.grails.MultiTenantCachingService
	at org.grails.MultiTenantCachingServiceSpec.$tt__$spock_feature_0_1(MultiTenantCachingServiceSpec.groovy:29)
	at org.grails.MultiTenantCachingServiceSpec.multi-tenant service method with @Cacheable annotation doesn't throw an exception_closure2(MultiTenantCachingServiceSpec.groovy)
	at groovy.lang.Closure.call(Closure.java:418)
	at groovy.lang.Closure.call(Closure.java:434)
	at grails.gorm.transactions.GrailsTransactionTemplate$1.doInTransaction(GrailsTransactionTemplate.groovy:68)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
	at grails.gorm.transactions.GrailsTransactionTemplate.executeAndRollback(GrailsTransactionTemplate.groovy:65)
	at org.grails.MultiTenantCachingServiceSpec.multi-tenant service method with @Cacheable annotation doesn't throw an exception(MultiTenantCachingServiceSpec.groovy)

It looks like the AST triggered by the @Cacheable annotation isn't playing nicely with the @CurrentTenant annotation.

Here's an example application using v4.0.1 of the plugin that demonstrates the issue: https://github.com/dpcasady/multi-tenant-cacheable

It has one integration test that when run will throw the exception above.

@dpcasady
Copy link
Author

Nevermind this issue, it looks like it was fixed in abb34dc.

Any plans to include this in a release soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant