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 C9308104B4 for ; Tue, 23 Dec 2014 06:56:13 +0000 (UTC) Received: (qmail 51863 invoked by uid 500); 23 Dec 2014 06:56:13 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 51841 invoked by uid 500); 23 Dec 2014 06:56:13 -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 51227 invoked by uid 99); 23 Dec 2014 06:56:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Dec 2014 06:56:12 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [162.242.166.79] (HELO us-rs09.objectstyle.com) (162.242.166.79) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 23 Dec 2014 06:56:08 +0000 Received: (qmail 13459 invoked by uid 509); 23 Dec 2014 06:55:46 -0000 Received: from unknown (HELO ?192.168.1.35?) (212.98.191.4) by us-rs09.objectstyle.com with SMTP; 23 Dec 2014 06:55:46 -0000 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: Archive tables From: Andrus Adamchik In-Reply-To: <5498657f.a266b40a.4df0.2b5f@mx.google.com> Date: Tue, 23 Dec 2014 09:55:45 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: <07E65535-2E79-470D-B3CE-2D635B8268F2@objectstyle.org> <88E69C39-6888-498B-80AC-E7A8FBE2CE0B@objectstyle.org> <54985977.9040502@lindesay.co.nz> <5498657f.a266b40a.4df0.2b5f@mx.google.com> To: user@cayenne.apache.org X-Mailer: Apple Mail (2.1993) X-Virus-Checked: Checked by ClamAV on apache.org > maybe I could initialize the second runtime there? Absolutely. > On Dec 22, 2014, at 9:38 PM, Markus Reich = wrote: >=20 > Yes, I'm already using cayenne. I get ObjectContext from BaseContent = ThreadLocal. I also use a self implemented CayenneFilter class, maybe I = could initialize the second runtime there? >=20 > ----- Urspr=C3=BCngliche Nachricht ----- > Von: "Andrew Lindesay" > Gesendet: =E2=80=8E22.=E2=80=8E12.=E2=80=8E2014 18:49 > An: "user@cayenne.apache.org" > Betreff: Re: Archive tables >=20 > Hello Markus; >=20 > Are you already using Cayenne with this application in some way? If = so,=20 > how are you creating the first ServerRuntime? If you are not using=20 > Cayenne with this application yet, can you explain a bit more about = your=20 > situation; Are you using Spring framework or some other DI framework = at=20 > all? Are you wanting one ObjectContext per request-response cycle? >=20 > Regards; >=20 > On 23/12/14 2:13 am, Markus Reich wrote: >> As I'm using cayenne in a JSP environment, where would be the best = place to >> create the 2nd runtime? I'm not sure how to do it right/best way? >> I just know how it's done in a desktop app >> ServerRuntime runtime =3D new ServerRuntime("cayenne-MII-MIP.xml"); >> Maybe there is a way to copy the existing runtime? >>=20 >> Andrus Adamchik schrieb am Fri Dec 19 2014 = at >> 11:24:29: >>=20 >>> Yeah, you'd start 2 runtimes, and rename a subset of DbEntities in = one of >>> them to add "_A". >>>=20 >>> Andrus >>>=20 >>>=20 >>>> On Dec 19, 2014, at 11:51 AM, Markus Reich = >>> wrote: >>>>=20 >>>> ad 1., yes it's a multiuser web app >>>> ad 2., it's just a subset, not all tables of the schema have = archive >>> tables >>>> ad 3., archive tables have a postfix _A in the tablename and are in = the >>>> same schema, but it would be not problem to transfer them to = another >>> scheme >>>>=20 >>>> The idea with the two runtimes sounds interesting >>>>=20 >>>>=20 >>>> Andrus Adamchik schrieb am Fri Dec 19 2014 = at >>>> 09:45:08: >>>>=20 >>>>> A few more things I need to ask: >>>>>=20 >>>>> * I assume it is a multi-user app? >>>>> * If a user checks the checkbox, you switch *all* entities to the >>> archive >>>>> tables, not just a subset of entities? >>>>> * How do you distinguish between regular and archive tables? Are >>> archives >>>>> in a separate schema, or in the same schema, but using different = naming >>>>> conventions? >>>>>=20 >>>>> But here is also an idea of the solution, that can be further = tweaked >>>>> depending on the answers. You need to start 2 ServerRuntime's (I = assume >>> you >>>>> are on Cayenne 3.1 / 4.0 here). One mapped to access regular = tables, and >>>>> another - the archive tables. And depending on a given user state, = you >>>>> allocate them an ObjectContext from the corresponding runtime. >>>>>=20 >>>>> Andrus >>>>>=20 >>>>>=20 >>>>>> On Dec 19, 2014, at 11:24 AM, Markus Reich < >>> markus.reich@markusreich.at> >>>>> wrote: >>>>>>=20 >>>>>> Hi Andrus, >>>>>>=20 >>>>>> the switch is durring runtime, so it's not defined at start up. = The >>>>> trigger >>>>>> is e.g. a checkbox in the ui where the user can decide if he want = to >>> read >>>>>> from archive. One idea was to create a view over archive and real >>> table, >>>>>> because it's only read only necessary. >>>>>>=20 >>>>>>=20 >>>>>> Andrus Adamchik schrieb am Fri Dec 19 = 2014 at >>>>>> 08:22:26: >>>>>>=20 >>>>>>> I guess the answer depends on what "easily" means. So a few = questions >>> to >>>>>>> clarify the scenario: >>>>>>>=20 >>>>>>> When you start an app, do you already know whether it will read = from >>>>>>> regular or archive tables? If not, what event triggers the = switch in >>> the >>>>>>> running app? Is this for all sessions or just specific users? >>>>>>>=20 >>>>>>> Andrus >>>>>>>=20 >>>>>>>> On Dec 19, 2014, at 10:08 AM, Markus Reich < >>>>> markus.reich@markusreich.at> >>>>>>> wrote: >>>>>>>>=20 >>>>>>>> Hi, >>>>>>>>=20 >>>>>>>> I need some hints for a very special issue :-) >>>>>>>> We have archived old entries of our tables to shadow tables, = which >>> have >>>>>>>> exactly the same columns structure as the source table. >>>>>>>>=20 >>>>>>>> No we need to have a possibility to switch easily between real = and >>>>>>>> shadowtable. >>>>>>>> Maybe someone already is/was facing such a constellation? >>>>>>>>=20 >>>>>>>> thx >>>>>>>> Meex >>>>>>>=20 >>>>>>>=20 >>>>>=20 >>>>>=20 >>>=20 >>>=20 >>=20 >=20 >=20 > --=20 > Andrew Lindesay