Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/grails-data-service/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
grails:
gorm:
multiTenancy:
mode: DISCRIMINATOR
tenantResolverClass: org.grails.datastore.mapping.multitenancy.web.SessionTenantResolver
---
grails:
profile: rest-api
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package example

import grails.gorm.MultiTenant

// Issue: https://github.com/grails/gorm-hibernate5/issues/450
// Pr: https://github.com/grails/gorm-hibernate5/pull/451
class MultitenantBook implements MultiTenant<MultitenantBook>, Serializable {
String id
String tenantId
String title

static mapping = {
id composite: ['id', 'tenantId']
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ protected void addMultiTenantFilterIfNecessary(
mappings.addFilterDefinition(new FilterDefinition(
GormProperties.TENANT_IDENTITY,
filterCondition,
Collections.singletonMap(GormProperties.TENANT_IDENTITY, persistentClass.getProperty(tenantId.getName()).getType())
Collections.singletonMap(GormProperties.TENANT_IDENTITY, getProperty(persistentClass, tenantId.getName()).getType())
));
}
}
Expand Down