• 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: EditingContext/Sorting Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EditingContext/Sorting Problem


  • Subject: Re: EditingContext/Sorting Problem
  • From: Ken Anderson <email@hidden>
  • Date: Tue, 3 Apr 2007 10:51:20 -0400

Use a separate method instead of overriding the existing method. There are assumptions made about the array returned via KVC, and you are breaking those assumptions by reordering an array that EOF thinks it owns.

On Apr 3, 2007, at 10:17 AM, David Avendasora wrote:

Hi all,

I have what is probably a really basic WO problem, but I have been trying to figure it out for the last couple days with no luck.

I have a superclass for my entity (_ManufacturingSchedule) that is generated by EOGenerator. It has the following method to return all the related objects in a to-many relationship:

public NSArray scheduledRoutings() {
	return (NSArray)storedValueForKey("scheduledRoutings");
}

I am overriding this method in the subclass (ManufacturingSchedule) with:

public NSArray scheduledRoutings() {
NSArray sortedArray;
NSMutableArray sortOrderings = new NSMutableArray();
EOSortOrdering productionSequenceSort = new EOSortOrdering ("productionSequence",EOSortOrdering.CompareAscending);
EOSortOrdering toolSort = new EOSortOrdering ("routing.tool.toolName",EOSortOrdering.CompareAscending);
sortOrderings.addObject(toolSort);
sortOrderings.addObject(productionSequenceSort);
sortedArray = EOSortOrdering.sortedArrayUsingKeyOrderArray (super.scheduledRoutings(),sortOrderings);
return sortedArray;
}


All I am trying to do is sort the results a certain way any time the related objects are requested. The problem is that when I use this method, any objects added to the relationship during the current session (one EditingContext per session right now) don't show up. If I save the EditingContext to the DB, then kill the session and call the relationship again, the objects I added show up.

If I simply remove the overriding method in the subclass, everything shows up as expected, just not sorted of course.

Why aren't new objects returned when sorted as above?

Dave

_______________________________________________
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
  • Follow-Ups:
    • Re: EditingContext/Sorting Problem SOLVED
      • From: David Avendasora <email@hidden>
References: 
 >EditingContext/Sorting Problem (From: David Avendasora <email@hidden>)

  • Prev by Date: Re: EditingContext/Sorting Problem
  • Next by Date: Re: EditingContext/Sorting Problem SOLVED
  • Previous by thread: Re: EditingContext/Sorting Problem
  • Next by thread: Re: EditingContext/Sorting Problem SOLVED
  • Index(es):
    • Date
    • Thread