Hi Tad, yeah, overlapping relationships (multiple relationships over the same db-path) are not automatically synchronized on a local change. I.e. Cayenne thinks "Slot -> Shift -> Schedule" and "Slot -> Schedule" are two unrelated things. So this is a "feature".
I've thought about it a few times in the past, and it should be possible to close this hole. But for now your approach of refetching a given relationship is one way to solve it. I am personally trying to avoid overlapping relationships in my models. Andrus On Jun 25, 2012, at 8:50 PM, Tad wrote: > Hi all, > > I have a setup with a relationship like the following: > > Slot (to one) Shift (to one) Schedule > > In the Modeler, I created a flattened relationship between Slot and > Schedule by traversing the Shift relationship: > > <obj-relationship name="schedule" source="Slot" target="Schedule" > db-relationship-path="shift.schedule"/> > > In most cases, this works fine. Calling Slot.getSchedule() resolves a > ToOneFault that returns the Schedule object. > > The problem I'm having is right after creating a Slot object, assigning it > to a new Shift object via Shift.addToSlots(Slot), then committing the > change. Calling Slot.getSchedule() ends up in > readPropertyDirectly("schedule"), which returns null because the ToOneFault > has not been populated. > > After re-querying the Slot, the Schedule field is populated correctly with > a ToOneFault. It is only directly after the Slot/Shift objects are created > and the ObjectContext has committed that this field is missing. > > Does this appear to be an error in my setup or procedure, an undocumented > quirk of flattened relationships, or a bug in Cayenne? > > Thanks for any help you can give. > > -Tad