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(); // Create new group EOModelGroup newGroup = new EOModelGroup(); newGroup.addModel(model); EOModelGroup.setDefaultGroup(newGroup);
// perform fetch NSArray results = EOUtilities.rawRowsForSQL(ec, "modelname", sql, null); // reset group to default EOModelGroup.setDefaultGroup(defaultGroup); return results; } |