You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Guido Beutler <gb...@catsoft.de> on 2006/03/09 12:02:47 UTC

Change od Schema during Runtime

Hello,

I would like to copy complex objects from schema A to schema B.
This would run in a managed environment (JBoss EJB Server)
The schema is configured at the XML Mapping, can I change this during runtime like
1) read data from schema A
2) change schema
3) store the same objects to schema B
Is the change of the schema only for this transaction? Because the mapping 
configured at repository XML will be used by other transactions while the copy is running.

best regards,

Guido

Re: Change od Schema during Runtime

Posted by Armin Waibel <ar...@apache.org>.
Hi Guido,

Guido Beutler wrote:
> Hello,
> 
> I would like to copy complex objects from schema A to schema B.

I suppose you mean copy data from one DB to another or from table A to 
table B within the same DB.

> This would run in a managed environment (JBoss EJB Server)
> The schema is configured at the XML Mapping, can I change this during runtime like
> 1) read data from schema A
> 2) change schema
> 3) store the same objects to schema B
> Is the change of the schema only for this transaction?

With default OJB settings no.

> Because the mapping 
> configured at repository XML will be used by other transactions while the copy is running.
> 

Exactly that's the problem. By default OJB use the same object metadata 
for all transactions/threads, so metadata changes will immediately 
noticed by all threads.
A PB instance can only "use" one metadata mapping, it's not possible to 
use different metadata mapping parallel with same PB instance.

But it's possible to use different metadata mapping on per thread base. 
Thus you can read the object using default schema A, then close current 
PB, load metadata profile B (using the MetadataManager), lookup a new PB 
instance (now associated with schema B).
http://db.apache.org/ojb/docu/guides/metadata.html#Per+thread+metadata+changes

regards,
Armin

> best regards,
> 
> Guido
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org