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 <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