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 Armin Waibel <ar...@code-au-lait.de> on 2003/09/15 12:28:56 UTC

Re: MetadataManager question

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: <jo...@talk21.com>
To: <oj...@db.apache.org>
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: 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


Create Table in OJB

Posted by Cory L Hubert <ch...@alloy.com>.
	I need to develop an application that will create tables dynamically.  Is
there a way to do that in OJB without using QueryBySQL.




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


RE: MetadataManager question

Posted by Joss Wright <jo...@talk21.com>.
Armin,

That worked!! Many thanks.

Regards,

Joss

> -----Original Message-----
> From: Armin Waibel [mailto:armin@code-au-lait.de]
> Sent: 15 September 2003 11:29
> To: OJB Users List
> Subject: Re: MetadataManager question
> 
> 
> 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: <jo...@talk21.com>
> To: <oj...@db.apache.org>
> 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: 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
> 

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