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 Hans Novak <hn...@repcom.de> on 2005/11/29 13:02:32 UTC

repository entries

Hi,

i want to change dynamicly the location of the database Server, what is 
describe in "repository.xml"
Is it possible, to read the defaults from the "repository.xml" and then, 
if is neccesery change the value temporary to another location ?
I dont want to overwrite the "repository.xml" file.
My wish is to change it on runtime.

Hans

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


Re: repository entries

Posted by Hans Novak <hn...@repcom.de>.
Armin Waibel schrieb:

>> i want to change dynamicly the location of the database Server, what 
>> is describe in "repository.xml"
>
>
> you can find some suggestion about metadata handling here
> http://db.apache.org/ojb/docu/guides/metadata.html

Hi,

first, thanks for your answer.
I have try some things from the web site.
it is not exactly what i wish. I want to chnage only 4 things: the user, 
the password, the database and the Server (of the database) only one 
time: at startup.
I read the my "new" settings from an user "ini" file. The 
"repository.xml" file cant be changed.

If i add "PersistenceBrokerFactory.createPersistenceBroker(myNewPbKey)" 
then at a second time, this class cant be called.
I get then an error "Found duplicate connection descriptor ...".
How can i use an existing "pbKey" ? (can i switch to it ?)

Hans

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


Re: repository entries

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

Hans Novak wrote:
> Hi,
> 
> i want to change dynamicly the location of the database Server, what is 
> describe in "repository.xml"
> Is it possible, to read the defaults from the "repository.xml" and then, 
> if is neccesery change the value temporary to another location ?
> I dont want to overwrite the "repository.xml" file.
> My wish is to change it on runtime.
>

you can find some suggestion about metadata handling here
http://db.apache.org/ojb/docu/guides/metadata.html

It's not recommended to change existing metadata instances at runtime, 
because all changes will be global changes (e.g. remove or add a new 
FieldDescriptor for a specific persistence capable class) or/and the 
changes will not be detected by OJB because the metadata information is 
only read once (e.g. when OJB setup a connection factory).

If you use different database server then it's recommended to setup a 
jdbc-connection-descriptor (jcd) for each DB (you can define different 
jcd in the repository file, read additional jcd in a separate repository 
file at runtime or completely create an jcd at runtime and add it to the 
existing onces). You can lookup the additional databases via the 
jcdAlias name of the jcd.
http://db.apache.org/ojb/docu/guides/pb-guide.html#lookup-pb
(Take care of cache synchronization when using the same persistence 
capable classes in different databases)

regards,
Armin


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

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