multi-tenant / grails-multi-tenant-single-db

Multi Tenant implementation for single database environments - Use grails-filtering and grails-hibernate-hijacker
Apache License 2.0
32 stars 25 forks source link

make tenantId an object type for more flexibility #23

Open basejump opened 12 years ago

basejump commented 12 years ago

currently we are locked into integer. a. grails uses long as default for id's b. we are also looking at using a UUID as an option right now too.

Does anyone foresee an issue with this? CurrentTenant.get would return and object now instead.

lucastex commented 12 years ago

Since the plugin uses the current tenant in all queries, the tenant value must have a "plain" way to save it in one database field. So, if we want to use an object as tenant representation, we should have a simple way to 'serialize' it and bring it back. Probably the tenant object should implement an interface with kind of marshal() and unmarshal() methods, or kind of that. Right? Then, when modifying the query in the database, the plugin would add the 'serialized tenant way'.

Don't know if I made myself clear :)

basejump commented 12 years ago

when you say tenant object , what do you mean? also for the filter its setup as follows multiTenantHibernateFilter(FilterDefinitionFactoryBean) { defaultFilterCondition = ":tenantId = $tenantColumnName" parameterTypes = [ tenantId: "java.lang.Integer" ] } we can make the type config come from the config.

lucastex commented 12 years ago

externalizing this config, to come from the config would be fine. we could use strings or other field types with no problems.