Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setting JDBC connection string for Eomodels during runtime



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:
http://lists.apple.com/mailman/options/webobjects-dev/ 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: http://lists.apple.com/mailman/options/webobjects-dev/email@hidden

This email sent to email@hidden
References: 
 >setting JDBC connection string for Eomodels during runtime (From: WebObjects <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.