You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Markus Reich <ma...@markusreich.at> on 2014/12/19 08:08:58 UTC
Archive tables
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
Re: Archive tables
Posted by Andrus Adamchik <an...@objectstyle.org>.
> maybe I could initialize the second runtime there?
Absolutely.
> On Dec 22, 2014, at 9:38 PM, Markus Reich <re...@gmail.com> wrote:
>
> 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" <ap...@lindesay.co.nz>
> Gesendet: 22.12.2014 18:49
> An: "user@cayenne.apache.org" <us...@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 <an...@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 <ma...@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 <an...@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.reich@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 <an...@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.reich@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
AW: Archive tables
Posted by Markus Reich <re...@gmail.com>.
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" <ap...@lindesay.co.nz>
Gesendet: 22.12.2014 18:49
An: "user@cayenne.apache.org" <us...@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 <an...@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 <ma...@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 <an...@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.reich@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 <an...@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.reich@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
Re: Archive tables
Posted by Andrew Lindesay <ap...@lindesay.co.nz>.
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 <an...@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 <ma...@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 <an...@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.reich@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 <an...@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.reich@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
Re: Archive tables
Posted by Markus Reich <ma...@markusreich.at>.
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 <an...@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 <ma...@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 <an...@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.reich@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 <an...@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.reich@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
> >>>>
> >>>>
> >>
> >>
>
>
Re: Archive tables
Posted by Andrus Adamchik <an...@objectstyle.org>.
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 <ma...@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 <an...@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 <ma...@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 <an...@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.reich@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
>>>>
>>>>
>>
>>
Re: Archive tables
Posted by Markus Reich <ma...@markusreich.at>.
very interesting, but we are using Oracle, Oracle has Partioning too, but I
think this is just all within one table
Andrew Lindesay <ap...@lindesay.co.nz> schrieb am Fri Dec 19 2014 at 10:18:12:
> Hello Markus;
>
> An idea that may or may not suit your situation;
>
> Are you using something like Postgres (PG) [1]? If so, you could create
> a 'master' table with 'child' tables -- a concept known as
> "partitioning". One might sometimes "partition" data like this based on
> something like a natural timestamp of your data such as the
> "create_timestamp" or similar, but it ought to be possible to partition
> based on a boolean column "archived" for example. This is a simplistic
> overview and a guess at what you are trying to do; see [2] for some more
> reading.
>
> If you model the master table in Cayenne and include the column that you
> are partitioning on, it should allow you to control if it hits the main
> table, the archive table or the archive and main table. Obviously this
> would require the qualifiers to be doctored in the application-server to
> suit.
>
> [1] http://www.postgresql.org/
> [2] http://www.postgresql.org/docs/9.3/static/ddl-partitioning.html
>
> Regards;
>
> On 19/12/14 9:51 pm, Markus Reich 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 <an...@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.reich@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 <an...@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.reich@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
>
Re: Archive tables
Posted by Andrew Lindesay <ap...@lindesay.co.nz>.
Hello Markus;
An idea that may or may not suit your situation;
Are you using something like Postgres (PG) [1]? If so, you could create
a 'master' table with 'child' tables -- a concept known as
"partitioning". One might sometimes "partition" data like this based on
something like a natural timestamp of your data such as the
"create_timestamp" or similar, but it ought to be possible to partition
based on a boolean column "archived" for example. This is a simplistic
overview and a guess at what you are trying to do; see [2] for some more
reading.
If you model the master table in Cayenne and include the column that you
are partitioning on, it should allow you to control if it hits the main
table, the archive table or the archive and main table. Obviously this
would require the qualifiers to be doctored in the application-server to
suit.
[1] http://www.postgresql.org/
[2] http://www.postgresql.org/docs/9.3/static/ddl-partitioning.html
Regards;
On 19/12/14 9:51 pm, Markus Reich 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 <an...@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 <ma...@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 <an...@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.reich@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
Re: Archive tables
Posted by Markus Reich <ma...@markusreich.at>.
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 <an...@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 <ma...@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 <an...@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.reich@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
> >>
> >>
>
>
Re: Archive tables
Posted by Andrus Adamchik <an...@objectstyle.org>.
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 <ma...@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 <an...@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 <ma...@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
>>
>>
Re: Archive tables
Posted by Markus Reich <ma...@markusreich.at>.
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 <an...@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 <ma...@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
>
>
Re: Archive tables
Posted by Andrus Adamchik <an...@objectstyle.org>.
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 <ma...@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