Re: setting JDBC connection string for Eomodels during runtime
Re: setting JDBC connection string for Eomodels during runtime
- Subject: Re: setting JDBC connection string for Eomodels during runtime
- From: Jean-François Veillette <email@hidden>
- Date: Thu, 30 Sep 2004 08:58:51 -0400
Be warned, we recently discovered a bug when we change the dictionary
for the default model group ( EOModelGroup.defaultGroup().models() ) at
application launch time (in application contructor for example).
PROBLEM : Unfortunately, EOF sometimes load a model more than once,
even though a model is already loaded in the default model group.
For example,
EOUtilities.rawRowsForSQL(ec, "MyModelName", sqlQuery, null);
will cause a new loading of the model named "MyModelName", it won't use
the one already loaded in the default model group.
So you have to change the connection dictionary every time a model is
loaded and not change the ones in your default eomodel group only at
launch time.
To change the dictionary every time a model is loaded, you have to
listen you a notification sent with the id
EOModelGroup.ModelAddedNotification, like :
NSNotificationCenter.defaultCenter().addObserver(myObserver, new
NSSelector("notificationModelLoaded", new Class[]
{NSNotification.class});, EOModelGroup.ModelAddedNotification, null);
...
public void notificationModelLoaded(NSNotification notification) {
EOModel model = (EOModel)notification.object();
adjustEOModelFromProperties(model);
}
Project wonder does it using notifications, so you can look at their
code if you need more details.
- jfv
Le 04-09-28, à 12:41, WebObjects a écrit :
I'd like to set the connection URL, UID, PWD, etc. to my dbase at
runtime.
Is there a good reference/class/method for handling this?
-Bill
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden