• 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: Dealing with objects not yet in a context (or shouldn't I ?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dealing with objects not yet in a context (or shouldn't I ?)


  • Subject: Re: Dealing with objects not yet in a context (or shouldn't I ?)
  • From: Miguel Arroz <email@hidden>
  • Date: Sun, 27 Aug 2006 13:45:10 +0100

Hi!

Short answer: you should NEVER use an EOObject not in a context. In fact, after creating an object, you should immediately insert it in a context. Any operation you do in an object before inserting it into a context may not be saved, and may cause strange behaviour.

  Yours

Miguel Arroz

On 2006/08/27, at 11:52, Yann Bizeul wrote:

Hi list,

	Here is the scenario :

	User <-->> LocationTagUser <<--> Location

Basically, Users does have different Locations for which they assign their tags (keywords, or whatever). I would be pleased to have a flattened relationship between Usres en Location, but since I have an additional attribute in the linking table, I can't, that's ok.

Now, a user does want to add a location, but before adding a duplicate one, we check the database to see if it (the Location) does not exists yet, and ask the user to choose among existing ones.

But I did the choice to not insert my temporary Location object the user is adding until I'm sure it is not a duplicate one, insted of adding it in the session's default context, and remove everything in case he choose an existing one (and remove Locations and associated LocationTagUsers) to replace with the existing object relationships. But that causes problems with Location's methods involving EOFetchSpecification.

Is this a wrong approach ? should a temporary object be part of the editing context as soon as it is born ?

What is the best way to manage such "temporary" objects with their relation to make the code as simple as possible ?

Thank you

Yann Bizeul • yann at tynsoe.org
Cocoa Developer

Tynsoe Projects
BuddyPop • GeekTool • SSH Tunnel Manager • ...
http://projects.tynsoe.org/


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40guiamac.com


This email sent to email@hidden


      "GUERRA E' PAZ
       LIBERDADE E' ESCRAVIDAO
       IGNORANCIA E' FORCA"       -- 1984

Miguel Arroz
http://www.ipragma.com



_______________________________________________
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


References: 
 >Dealing with objects not yet in a context (or shouldn't I ?) (From: Yann Bizeul <email@hidden>)

  • Prev by Date: EOModeler problem
  • Next by Date: Fwd: Looks like ThinkSecret got some of the scoop on WO from WWDC'06
  • Previous by thread: Dealing with objects not yet in a context (or shouldn't I ?)
  • Next by thread: Re: Dealing with objects not yet in a context (or shouldn't I ?)
  • Index(es):
    • Date
    • Thread