Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 79157 invoked from network); 26 Jul 2009 13:26:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Jul 2009 13:26:09 -0000 Received: (qmail 65021 invoked by uid 500); 26 Jul 2009 13:27:14 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 65007 invoked by uid 500); 26 Jul 2009 13:27:14 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 64997 invoked by uid 99); 26 Jul 2009 13:27:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Jul 2009 13:27:14 +0000 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gcjcu-cayenne-user-moved1@m.gmane.org designates 80.91.229.2 as permitted sender) Received: from [80.91.229.2] (HELO ciao.gmane.org) (80.91.229.2) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Jul 2009 13:27:03 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MV3kO-0005au-VP for user@cayenne.apache.org; Sun, 26 Jul 2009 13:26:40 +0000 Received: from dhcp-vpn-89-206-68-38.uzh.ch ([89.206.68.38]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Jul 2009 13:26:40 +0000 Received: from andreas by dhcp-vpn-89-206-68-38.uzh.ch with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Jul 2009 13:26:40 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: user@cayenne.apache.org From: Andreas Hartmann Subject: Re: PostgreSQL schemas for multi-tenant application Date: Sun, 26 Jul 2009 15:26:26 +0200 Lines: 32 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dhcp-vpn-89-206-68-38.uzh.ch User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) In-Reply-To: Sender: news X-Virus-Checked: Checked by ClamAV on apache.org 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); TIA! -- Andreas -- Andreas Hartmann, CTO BeCompany GmbH http://www.becompany.ch Tel.: +41 (0) 43 818 57 01