Re: EOModelGroup defaultGroup question
Re: EOModelGroup defaultGroup question
- Subject: Re: EOModelGroup defaultGroup question
- From: Scott Lopatin <email@hidden>
- Date: Mon, 19 Nov 2007 17:51:04 -0800
I ended up using this method, works great, but have to make sure to
reset to primary connection when done:
http://developer.apple.com/documentation/WebObjects/Enterprise_Objects/Connecting/chapter_10_section_8.html
Thanks!
-Scott
On Nov 19, 2007, at 4:13 PM, Scott Lopatin wrote:
On Nov 19, 2007, at 4:00 PM, Chuck Hill wrote:
On Nov 19, 2007, at 3:45 PM, Scott Lopatin wrote:
Hi!
I have a method like the one below, where I want to send in a
model with a different connection dictionary and execute a fetch
using the alternate model database. I'm running the below, setting
the new default group, then setting it back, however the results
always appear to come from the regular default model group, not
the new model group I'm setting below. Does anyone see something
I'm missing?
Thanks,
Scott
public static NSArray
executeSQLForModelWithResults(EOEditingContext ec, String sql,
EOModel model) {
// Save defaultGroup
EOModelGroup defaultGroup = EOModelGroup.defaultGroup();
defaultGroup.models().containsObject(model) == false, right? But
it contains a different instance of EOModel that has the same
entities?
defaultGroup contains model with same name, but not the same
connection dictionary.
// Create new group
EOModelGroup newGroup = new EOModelGroup();
newGroup.addModel(model);
EOModelGroup.setDefaultGroup(newGroup);
Probably not a good idea to mess with this... Things run deeper
here.
Hmm
// perform fetch
NSArray results = EOUtilities.rawRowsForSQL(ec, "modelname", sql,
null);
ec's are model group / EOF stack specific. You can not pass in an
EC like that. You need a whole new EOF stack with a new database,
database context, and object store co-ordinator.
What is a safe way to create a new EOF stack?
Chuck
// reset group to default
EOModelGroup.setDefaultGroup(defaultGroup);
return results;
}
_______________________________________________
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
_______________________________________________
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