• 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: Antw: Re: Migrating Data from a temporary table into anothereditingcontext
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Antw: Re: Migrating Data from a temporary table into anothereditingcontext


  • Subject: Re: Antw: Re: Migrating Data from a temporary table into anothereditingcontext
  • From: "Andri vonAllmen" <email@hidden>
  • Date: Tue, 05 May 2009 14:30:56 +0200

> There is something going on that you are not telling us.
 
I'm also assuming, that my "problem" is something for the school of bleeding obvious...
 
However, by way of trial, I changed the temporary table to a permanent one, and my problems have been solved (temporarily). Since I have to deal with temporary tables anyway, this did not help of course.
 
The only "solution" that is working (as far as I can evakzate) is the following one:
 
1. The data are inserted into the temporary table from the users session and editing context.
2. For each record fetched, a new one is created in the memory only (still in the user session and the object is not inserted into any editing context at this point)
3. The memory objects are passed to the thread
4. The thread (assuming he has to deal with enterprise objects only) has to insert these memory objects in its own editing context.
5. If done as described above, from now on, all attributes and relationships are accessible.
 
Note: point 2 does not work if using reflection (this, again, does induce everything to return null values), I really had to do the following in the users session:
 
NSMutableArray memoryObjects = new NSMutableArray();
Enumeration enumerator = userSessionObjects.objectEnumerator();
while (enumerator.hasMoreElements()) {
 SomeEnterpriseObject aUserSessionObject = (SomeEnterpriseObject)enumerator.nextElement();
 SomeEnterpriseObject aMemoryObject = new SomeEnterpriseObject(); // do not insert this one into any editing context (this is done by the thread)
 aMemoryObject.setName(anObject.name()); // using the getter and setter methods (this may be cumbersome for lots of attributes and relationships)
 aMemoryObject.setXY(anObject.XY()); // using the getter and setter methods (this may be cumbersome for lots of attributes and relationships)
 ...
 
That isn't nice, since every object is stored twice (for a short time only indeed) in the database, but it works.
 
 _______________________________________________
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: Antw: Re: Migrating Data from a temporary table into anothereditingcontext
      • From: Chuck Hill <email@hidden>
References: 
 >Antw: Re: Migrating Data from a temporary table into another editingcontext (From: "Andri vonAllmen" <email@hidden>)
 >Re: Antw: Re: Migrating Data from a temporary table into another editingcontext (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Need some advice for integrating a Cocoa and WO app
  • Next by Date: Re: Passing a wrapper component to a page-level component
  • Previous by thread: Re: Antw: Re: Migrating Data from a temporary table into another editingcontext
  • Next by thread: Re: Antw: Re: Migrating Data from a temporary table into anothereditingcontext
  • Index(es):
    • Date
    • Thread