Re: PostgreSQL schemas for multi-tenant application

From: Andreas Hartmann (andrea..pache.org)
Date: Sun Jul 26 2009 - 10:51:27 EDT

  • Next message: Michael Gentry: "Re: PostgreSQL schemas for multi-tenant application"

    Andreas Hartmann schrieb:
    > Andreas Hartmann schrieb:
    >> Hi Cayenne users & devs,
    >>
    >> I'm currently designing the DB + ORM layer for a multi-tenant
    >> application, using PostgreSQL 8.3 and Cayenne 2.0.4.
    >>
    >> After some research it looks like PostgreSQL schemas are a pretty
    >> decent way to achieve the separation of the tenant data on the DB
    >> level. Unfortunately, it looks like multiple schemas are not supported
    >> by Cayenne.
    >
    > I just noticed that the DbEntity class has a schema property. Would the
    > following approach work?
    >
    > Create a DB entity for each table in each schema, e.g. users_schema1,
    > users_schema2 etc.
    >
    > To run a query:
    >
    > DbEntity entity = dataMap.getDbEntity("users_" + schemaName);
    > SelectQuery query = new SelectQuery(entity, expression);

    It seems like this won't work because for each DB entity an object
    entity (i.e. class) would be required.

    But I found the section on multiple DataDomains in the documentation. I
    guess this is the way to go?

    -- Andreas

    -- 
    Andreas Hartmann, CTO
    BeCompany GmbH
    http://www.becompany.ch
    Tel.: +41 (0) 43 818 57 01
    



    This archive was generated by hypermail 2.0.0 : Sun Jul 26 2009 - 10:52:23 EDT