Dealing with temporary EOs
Dealing with temporary EOs
- Subject: Dealing with temporary EOs
- From: Logan Allred <email@hidden>
- Date: Sat, 23 Jul 2005 13:44:05 -0600
I need to create a bunch of temporary EOs (dozens to hundreds, maybe
eventually a few thousand), which I then do a bunch of analysis on,
and present them to the user. The user may then save some of them to
the DB, or just ignore them all (this is the common case), in which
case they will be thrown away.
My initial attempt was to create a peer editing context, create all
of the EOs in that editing context (and get local instances of any
EOs from the main editing context for relationships), then if the
user elects to save any of them, do localInstanceOfObject(mainEC,
object) and then mainEC.saveChanges(). However, as I discovered from
the list archives, newly created EOs in peer editing contexts return
null when using localInstanceOfObject.
What would be the recommended way to deal with this issue? Am I just
architecting my application badly (always a possibility). I've
considered not using EOs at all for the temporary objects, but all of
the analysis logic is already coded into the EOs themselves, so it
seems a waste to create a duplicate object with the same code that
just doesn't extend EOEnterpriseObject. I understand that it's a bad
thing to create these EOs and manipulate them outside of an editing
context, hence the peer context.
The only other solution I can think of is to delete all of the EOs
that the user ignores, and then just save the peer editing context.
Is this the recommended solution? This is the solution I'm going to
implement, unless I get a better suggestion. Hopefully it's not too
expensive, as the common case is for the user to do nothing, or maybe
save a few.
thanks,
Logan Allred
_______________________________________________
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