EditingContext/Sorting Problem
EditingContext/Sorting Problem
- Subject: EditingContext/Sorting Problem
- From: David Avendasora <email@hidden>
- Date: Tue, 3 Apr 2007 09:17:15 -0500
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:
This email sent to email@hidden