Re: Does WebObjects use Java 1.5?
Re: Does WebObjects use Java 1.5?
- Subject: Re: Does WebObjects use Java 1.5?
- From: Francis Labrie <email@hidden>
- Date: Fri, 23 Mar 2007 09:18:38 -0400
Hi,
David Avendasora wrote:
I have been using this for-loop structure in an app I'm currently
developing and it seems to work very well, and I haven't even
needed the .toArray() call at the end. Now, I'm not a WO expert so
I can't promise you that it will work in your specific circumstances.
This is an example of how I use it and cast the generic objects:
for (Object aRoutingObject : this.routings()) {
Routing aRouting = (Routing)aRoutingObject;
/* Stuff I want to do with each member (aRouting) of the routings
() to-many relationship
...
...
*/
}
If "routings()" method is a to-many relationship, you just have been
lucky or you are using a com.webobjects.eocontrol._EOCheapCopyArray
class patch (like the one in EOExtensions). With a plain vanilla
WebObjects, this loop will only work if the relationship array fault
have been fired. If it's still a fault, your loop will do nothing.
To test that, just fetch an fresh EO having a mandatory to-many
relationship, and loop through the to-many relationship using Java 5
enhanced for loop or the Iterator interface. If your array fault has
not been fired, your loop will not iterate through the target EOs...
--
Francis Labrie
Saint-Bruno-de-Montarville, Québec, Canada
_______________________________________________
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