• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EOModelGroup defaultGroup question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOModelGroup defaultGroup question


  • Subject: Re: EOModelGroup defaultGroup question
  • From: Scott Lopatin <email@hidden>
  • Date: Mon, 19 Nov 2007 16:13:19 -0800




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


  • Follow-Ups:
    • Re: EOModelGroup defaultGroup question
      • From: Scott Lopatin <email@hidden>
References: 
 >SQL Server questions (From: Randy Wigginton <email@hidden>)
 >EOModelGroup defaultGroup question (From: Scott Lopatin <email@hidden>)
 >Re: EOModelGroup defaultGroup question (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: EOModelGroup defaultGroup question
  • Next by Date: Java EOGenerator Templates
  • Previous by thread: Re: EOModelGroup defaultGroup question
  • Next by thread: Re: EOModelGroup defaultGroup question
  • Index(es):
    • Date
    • Thread