• 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: Flattened relationship and iterator oddness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Flattened relationship and iterator oddness


  • Subject: Re: Flattened relationship and iterator oddness
  • From: Jean Pierre Malrieu <email@hidden>
  • Date: Sun, 10 Sep 2006 08:50:36 +0200

I stumbbled on this one too. Did someone file a bug report ?

JPM


Fabian,

I discovered this a month or two ago.  It appears as if iterator()
does not fire the fault on relationships.  That is why with your log
statement everything is ok: the accessing of the productionRuns()
field IS firing the fault.  The iterator then works.  This is a bug
in the iterator implementation.  The only thing you can do is either
manually fire each fault or use objectEnumerator().  I use
objectEnumerator().

John

On Sep 8, 2006, at 4:28 PM, Fabian Peters wrote:


Hi,

I've got the following entities:

    Order <->> OrderItem <<->> ProductionRun <-> DeliveryDefect

In Order, I've defined a flattened relationship deliveryDefects. It
works fine for deliveryDefects that exist when the order is fetched
from the DB. However, it fails to include a deliveryDefect that is
created and then saved to the DB. Is this a known limitation of
flattened relationships?

Not all too important since I can of course get to it myself. Part
of my first implementation looked like this:

        for (Iterator iter = orderItems().iterator(); iter.hasNext
();) {
            OrderItem anOrderItem = (OrderItem) iter.next();
            // log.debug("production run count: " +
anOrderItem.productionRuns().count());
            for (Iterator iterator = anOrderItem.productionRuns
().iterator(); iterator
                    .hasNext();) {
                ProductionRun aProductionRun = (ProductionRun)
iterator.next();
                if (aProductionRun.deliveryDefect() != null)
                    deliveryDefects.addObject
(aProductionRun.deliveryDefect());
            }
        }

Now, I'm using WO 5.3 with java 1.5.0, so I assumed this should
work. But it fails due to iterator.hasNext() always returning
false. While debugging, I introduced the log statement that is
commented out above. With that in place, the iterator starts to
behave correctly!?

I'd really like to understand what's going on here! Is the
productionRuns() fault not getting fired by the iterator? Is this
intended/documented?

Now I'm back to using good old Enumeration which works w/o further
ado.

Any comments most welcome...

Fabian
_______________________________________________
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: Flattened relationship and iterator oddness
      • From: Fabian Peters <email@hidden>
  • Prev by Date: Re: Obtain the name of a server in WO
  • Next by Date: Statless Component and component Action
  • Previous by thread: Re: Flattened relationship and iterator oddness
  • Next by thread: Re: Flattened relationship and iterator oddness
  • Index(es):
    • Date
    • Thread