Hi Joss,

1. Change database name before the first time PersistenceBrokerFactory
was called.
2.
MetadataManager.getInstance().connectionRepository().getAllDescriptor()
returns a deep copy of all JdbcConnectionDescriptors!
So get your descriptor from list, change it, get PBKey of the changed
descriptor call
CR.removeDescriptor(Object validKey)
to remove old JCD
call addDescriptor(JdbcConnectionDescriptor jcd)
to add the changed JCD.

HTH

regards,
Armin



----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 15, 2003 12:48 PM
Subject: MetadataManager question


Is it possible to change the value of dbalias at runtime?

I would like to prefix the value of dbalias defined in repository.xml
with a value at runtime. This is because I am using HSQLDB in standalone
mode, inside a web application, and I would like to define the name of
the database inside the repository.xml, e.g. test-db, but I'd like to
define the path of the database at runtime, e.g. C:\My Documents\My
Webapp\test-db.

I tried using:

MetadataManager.getInstance().connectionRepository().getAllDescriptor()

to get a list of descriptor then find and return the default descriptor.
Then, for example:

String path = "C:\My Documents\My Webapp\";
descriptor.setDbAlias(path + descriptor.getDbAlias());

However when I call:

PersistenceBrokerFactory.defaultPersitenceBroker()

DbAlias is still "test-db" rather than "C:\My Documents\My
Webapp\test-db"

Do I have to somehow 'save' the new descriptor values before I can use
them? Or can I only create a new descriptor dynamically and not merge
dynamic descriptor attributes with static descriptor attributes?

Any help would be gratefully received.

Regards,

Joss Wright





--------------------
talk21 your FREE portable and private address on the net at
http://www.talk21.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to