• 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: Remove a EOEnterpriseObject from an editing context
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Remove a EOEnterpriseObject from an editing context


  • Subject: Re: Remove a EOEnterpriseObject from an editing context
  • From: Ken Anderson <email@hidden>
  • Date: Mon, 24 Jul 2006 21:47:45 -0400


On Jul 24, 2006, at 6:38 PM, Edgar Ra. Klein wrote:

Ken,

On 24.07.2006, at 19:24, Ken Anderson wrote:

Edgar,

There are probably a lot better approaches than trying to create EOs and then move them to another context. As I understand it, you're importing a large file that has cross references. I have a few questions:

Are you waiting to complete a single EO, or are you waiting to hook multiple EOs together in a relationship?

I actually save every eo after about 100 objects are inserted in order to avoid performance problems I encountered at the beginning b/c of saving the editing context after every insert of an object.

Yes, saving after every EO is created can be very slow indeed! It's different for everyone, but 100 sounds like a reasonable number.



If you're waiting to complete a single EO and need data from multiple parts of the file, is it possible to split up the EO into multiple EOs?

Wouldn't I have the same problem as I already have?

What I'm suggesting is if every line you import from the file can be saved as an EO, you can just import and save linearly. After importing say, 3000 objects, you could destroy the editing context and start with a fresh one. If you need to link up the EO you just created with an old one that's no longer in memory, it's no problem to fault it back in so you can connect them.



If you're waiting to connect multiple EOs together in a relationship, is there a reason you can't save the first part?

Like this I wanted to count the objects I correctly inserted in order to compare the number of the completed inserts with the given check count from the file.

OK - hopefully you can do that in any case.


How much memory are you allocating to the VM?

I launch the application with Eclipse. I could probably increase the memory for the VM manually but this doesn't really solve my problem b/c assume that there were some incorrect references, that would blow my whole import and all the gathered data would be lost.

Launching through eclipse doesn't automatically get you more memory. Most large webobjects apps require increasing virtual memory. For one of my larger apps, I do -Xmx800m -Xms200m - this means, start out with 200 megabytes, and allow it to increase to a max of 800 megabytes. You're probably starting with a tiny amount of memory if you're not setting these options.



How large is your file, and how many objects do you expect to instantiate from each?

The largest file contains about 350,000 data items each having about 80 attributes.

OK, so you have a lot to import. What I would typically do in this case is try to organize my editing context in a way that kept most of the common objects to link to in the context, but getting rid of objects that will not be needed. If for some reason you need an object that you got rid of, you can always fault it back in.



Ed

Ken

On Jul 24, 2006, at 1:16 PM, Edgar Ra. Klein wrote:

Hi Ken,

On 24.07.2006, at 19:06, Ken Anderson wrote:

Edgar,

Is there a reason you're not doing it all in one editing context?

Because of the OutOfMemoryException!

Ed


Ken

On Jul 24, 2006, at 12:55 PM, Edgar Ra. Klein wrote:

Hi Ken,

On 24.07.2006, at 14:37, Ken Anderson wrote:

Edgar,

If you do ec.deleteObject(obj) and it has never been saved, it will just be removed.

Care to share why you want to process this way?

Ken

I have to import quite some data items from a file. Some of them reference to others which are still not in the database. My approach is that I work with ec1 and if I collect a data item for which there is still no reference in the data base, I move it to ec2. This ec2 will be saved after all the other data has been set.


I hope my explanations are not too confusing ;-)

Ed

On Jul 24, 2006, at 7:43 AM, Edgar Ra. Klein wrote:

Hi,

I'm writing an application to import data from files and have a problem inserting an EOEnterpriseObject from an unsaved editing context into another one. More precisely, I have an EOEnterpriseObject inserted into an editing context ec1. After some processing this object isn't complete to be saved, hence I wanted to remove it from ec1, insert it into another editing context ec2, and try to update the reference later.

I already tried to remove the object from ec1 by using the following code:
- ec1.forgetObject(eoObject); (I know, I should not invoke this method, but this approach doesn't work anyway)
The problem here is that there is still a null object in the editing context ec1.


Is there a possibility to unregister a newly generated object (not saved in the database) from its current editing context (this editing context should be empty, if this object was the only object) and to insert it into another one?

Thanx,
Edgar
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobjects- 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
References: 
 >Remove a EOEnterpriseObject from an editing context (From: "Edgar Ra. Klein" <email@hidden>)
 >Re: Remove a EOEnterpriseObject from an editing context (From: Ken Anderson <email@hidden>)
 >Re: Remove a EOEnterpriseObject from an editing context (From: Ken Anderson <email@hidden>)
 >Re: Remove a EOEnterpriseObject from an editing context (From: "Edgar Ra. Klein" <email@hidden>)

  • Prev by Date: Question for Eclipse+Perforce users
  • Next by Date: no kiero resibir estos msn para nada y nunca
  • Previous by thread: Re: Remove a EOEnterpriseObject from an editing context
  • Next by thread: Re: WWDC WO Meet Up List
  • Index(es):
    • Date
    • Thread