cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Multi tenacy with schema per tenant with 'some' tables shared
Date Thu, 24 Dec 2015 06:47:46 GMT
> Was thinking about to point just the tables that must be separated per
> company, into the company specific schema, leaving those that are meant to
> be share into the public schema.

This sounds about right to me.

Andrus



> On Dec 22, 2015, at 12:18 AM, emanuele m <emamaia73@gmail.com> wrote:
> 
> Actually i have an application
> using cayenne 3.1 stack, with postgress 9.3 as database,
> that implements multiteancy creating
> a separate ServerRuntime per "Company" that relocates
> DbEntities on a specific postgress schema, using an
> XMLDataMapLoader with overrided load method as follow:
> 
> public DataMap load(Resource configurationResource) {
>        DataMap map = super.load(configurationResource);
>        map.setDefaultSchema(tenantSchema);
>        for (DbEntity e : map.getDbEntities()) {
>            e.setSchema(tenantSchema);
>                String sequence =
> tenantSchema.concat(".").concat(e.getPrimaryKeyGenerator().getGeneratorName());
>                e.getPrimaryKeyGenerator().setGeneratorName(sequence);
> 
>        }
> 
>        return map;
> }
> 
> As result i have a serverruntime per "Company" from which every user
> obtains his own ObjectContext(s).
> 
> Now i would need to map some tables into a shared schema.
> 
> Was thinking about to point just the tables that must be separated per
> company, into the company specific schema, leaving those that are meant to
> be share into the public schema.
> Clearly there are no relationships between the "shared" entities and the
> "Company" ones.
> 
> Any advice orsuggestions will be greatly appreciated.
> 
> Thanks,
> Emanuele


Mime
View raw message