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?
----- Ursprüngliche Nachricht ----- Von: "Andrew Lindesay" <a...@lindesay.co.nz> Gesendet: 22.12.2014 18:49 An: "user@cayenne.apache.org" <user@cayenne.apache.org> Betreff: Re: Archive tables Hello Markus; Are you already using Cayenne with this application in some way? If so, how are you creating the first ServerRuntime? If you are not using Cayenne with this application yet, can you explain a bit more about your situation; Are you using Spring framework or some other DI framework at all? Are you wanting one ObjectContext per request-response cycle? Regards; 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 = new ServerRuntime("cayenne-MII-MIP.xml"); > Maybe there is a way to copy the existing runtime? > > Andrus Adamchik <and...@objectstyle.org> schrieb am Fri Dec 19 2014 at > 11:24:29: > >> Yeah, you'd start 2 runtimes, and rename a subset of DbEntities in one of >> them to add "_A". >> >> Andrus >> >> >>> On Dec 19, 2014, at 11:51 AM, Markus Reich <markus.re...@markusreich.at> >> wrote: >>> >>> 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 >>> >>> The idea with the two runtimes sounds interesting >>> >>> >>> Andrus Adamchik <and...@objectstyle.org> schrieb am Fri Dec 19 2014 at >>> 09:45:08: >>> >>>> A few more things I need to ask: >>>> >>>> * 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? >>>> >>>> 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. >>>> >>>> Andrus >>>> >>>> >>>>> On Dec 19, 2014, at 11:24 AM, Markus Reich < >> markus.re...@markusreich.at> >>>> wrote: >>>>> >>>>> Hi Andrus, >>>>> >>>>> 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. >>>>> >>>>> >>>>> Andrus Adamchik <and...@objectstyle.org> schrieb am Fri Dec 19 2014 at >>>>> 08:22:26: >>>>> >>>>>> I guess the answer depends on what "easily" means. So a few questions >> to >>>>>> clarify the scenario: >>>>>> >>>>>> 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? >>>>>> >>>>>> Andrus >>>>>> >>>>>>> On Dec 19, 2014, at 10:08 AM, Markus Reich < >>>> markus.re...@markusreich.at> >>>>>> wrote: >>>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> 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. >>>>>>> >>>>>>> No we need to have a possibility to switch easily between real and >>>>>>> shadowtable. >>>>>>> Maybe someone already is/was facing such a constellation? >>>>>>> >>>>>>> thx >>>>>>> Meex >>>>>> >>>>>> >>>> >>>> >> >> > -- Andrew Lindesay