Re: Dealing with objects not yet in a context (or shouldn't I ?)
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: Ken Anderson <email@hidden>
- Date: Sun, 27 Aug 2006 09:13:15 -0400
Create the temporary Location and insert it into the context. If you
discover it's a duplicate, delete it. When you delete an unsaved
object, it just removes it from the context and doesn't generate any
SQL.
On Aug 27, 2006, at 6:52 AM, 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:
40anderhome.com
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