Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F0C0E18FF7 for ; Thu, 24 Dec 2015 06:48:12 +0000 (UTC) Received: (qmail 57884 invoked by uid 500); 24 Dec 2015 06:47:50 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 57857 invoked by uid 500); 24 Dec 2015 06:47:50 -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 57404 invoked by uid 99); 24 Dec 2015 06:47:49 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Dec 2015 06:47:49 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 5D62CC33CF for ; Thu, 24 Dec 2015 06:47:49 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.101 X-Spam-Level: X-Spam-Status: No, score=-0.101 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=objectstyle.org header.b=UpmjuB5T; dkim=pass (1024-bit key) header.d=messagingengine.com header.b=UzXHH42B Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id m5QOM8SS86XP for ; Thu, 24 Dec 2015 06:47:48 +0000 (UTC) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 5BC4142B74 for ; Thu, 24 Dec 2015 06:47:48 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 4B8ED15A for ; Thu, 24 Dec 2015 01:47:48 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Thu, 24 Dec 2015 01:47:48 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=objectstyle.org; h=content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=o25odKZlYjGZmKB41RqU78QElN8=; b=UpmjuB 5ThsX/lrKtawZyRXzBUXN5fidCNOpLTlA5psWU92h9zW7qpy4mZL35yxR4mqXFzV kK1IUh/nB2fwBPkoJpMDCvYImUwttByZCrZDPBniPKxtKmkvLdVOsWlNUr4P2QJQ oFiWcIXhOM1qIaVy2fV+p61OsUZmUWXQIXiMI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=o25odKZlYjGZmKB 41RqU78QElN8=; b=UzXHH42BP6ipZZr7hKNiff/NYAGcGJ7ohb7a5JVf9YoCF8x AGG+UHY6FSZ4mnVrlzD0h+l9J/jj+noTK8qZxSEY8kFrP0wjrB0VPw5qzTR1uXCR Hj2W9intqOtwyHFwgGUWJw+9+KjHLNR6KWf533M/jrHQM896YP3UI732QQWs= X-Sasl-enc: TBaB3R2xnJZ4KCreCfX6algwNmfJyKfnDwuOXx3xiLKh 1450939667 Received: from [192.168.1.63] (unknown [212.98.191.4]) by mail.messagingengine.com (Postfix) with ESMTPA id 8CAA6C016DB for ; Thu, 24 Dec 2015 01:47:47 -0500 (EST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Subject: Re: Multi tenacy with schema per tenant with 'some' tables shared From: Andrus Adamchik In-Reply-To: Date: Thu, 24 Dec 2015 09:47:46 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: user@cayenne.apache.org X-Mailer: Apple Mail (2.3112) > 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 wrote: >=20 > 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: >=20 > public DataMap load(Resource configurationResource) { > DataMap map =3D super.load(configurationResource); > map.setDefaultSchema(tenantSchema); > for (DbEntity e : map.getDbEntities()) { > e.setSchema(tenantSchema); > String sequence =3D > = tenantSchema.concat(".").concat(e.getPrimaryKeyGenerator().getGeneratorNam= e()); > e.getPrimaryKeyGenerator().setGeneratorName(sequence); >=20 > } >=20 > return map; > } >=20 > As result i have a serverruntime per "Company" from which every user > obtains his own ObjectContext(s). >=20 > Now i would need to map some tables into a shared schema. >=20 > 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. >=20 > Any advice orsuggestions will be greatly appreciated. >=20 > Thanks, > Emanuele