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