• 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
Duplicating Enterprise Objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Duplicating Enterprise Objects


  • Subject: Duplicating Enterprise Objects
  • From: Stefan Klein <email@hidden>
  • Date: Mon, 05 Nov 2007 11:41:28 +0100

Hi,

I use the deepCopy method described in "Practical Web Objects" (every WO developer should have one :-) ).

Enumeration relationshipEnumerator = publicRelationships.objectEnumerator();
EORelationship aRelationship;
while (relationshipEnumerator.hasMoreElements()){
aRelationship = (EORelationship) relationshipEnumerator.nextElement();
if (aRelationship.isToMany()) {
// Copy each element of the to-many array
NSArray relatedObjects = (NSArray) original.valueForKey(aRelationship.name());
for (int i = 0, count = relatedObjects.count(); i < count; i++)
...


This work fine if the relationship method is the original generated:
getFoo() { storedValueForKey("foo"); }

But if i override it in the subclass like:
getFoo() {
NSArray array = super.getFoo();
if (array != null && array.count() > 0) {
// hint: _collationArray use EOSortOrdering.sortArrayUsingKeyOrderArray on instances of NSMutableArray
array = _collationArray(array, _Foo.KAUFLAGE + "." + _KAuflage.ORDERBY_KENNZEICHEN);
}
return array;
}


all get messed up.

To get totally confused if I use:

// Copy each element of the to-many array
NSArray relatedObjects = new NSArray((NSArray) original.valueForKey(aRelationship.name()));
int count = relatedObjects.count();
for (int i = 0; i < count; i++) {
...


in deepCopy the copy semes to be ok.

Can anyone explain why ?


Stefan

_______________________________________________
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: Duplicating Enterprise Objects
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Re: WebObjects Community Web site
  • Next by Date: Re: WO For Windows?
  • Previous by thread: Re: [philosophical question] Direct component access: does it have any use at all?
  • Next by thread: Re: Duplicating Enterprise Objects
  • Index(es):
    • Date
    • Thread