You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Kevin Menard <km...@servprise.com> on 2007/12/11 21:37:06 UTC
Faulting nested relationships
Hi,
I have a nested relationship that I can't seem to update. I have something
like the following:
Order ---* OrderEntry ---* ShipmentEntry ---* Shipment
I added a nested relationship on Order to Shipment so I wouldn't have to
manually traverse all of that.
If I create a new Shipment and associate a ShipmentEntry with it that is in
turn associated with an OrderEntry, a call to Order#getShipments() will not
recognize the new Shipment. If I manually traverse the path, however, the
data is correct. Grabbing a new context, the call to Order#getShipments()
is correct.
I've tried using variants of RefreshQuery to no avail. So, any help would
be appreciated. This is in Cayenne 3.0-trunk in an ROP client environment.
If I can't get that going, I'll just have to write my own getShipments() I
guess.
Thanks,
Kevin
Re: Faulting nested relationships
Posted by Kevin Menard <km...@servprise.com>.
I have done precisely what you were saying and realize that the relationship
is read-only. I just thought it would reflect the latest state of the
graph. Moreover, I'd have thought RefreshQuery would have done the trick.
I'm beginning to think this may be a caching problem in the ROP client.
I'll have to play with the server classes to really tell.
--
Kevin
On 12/11/07 4:12 PM, "Michael Gentry" <bl...@gmail.com> wrote:
> My mistake -- I thought you had hand-written a cover method in your
> getShipments() method.
>
> Is the following what might be causing your problem?
>
> "Most of flattened relationships are treated as read-only by Cayenne.
> Only one (the most commonly used) type is read/write. It is
> many-to-many (n:m) flattened relationships with a single join table."
>
> http://cayenne.apache.org/doc/cayennemodeler-flattened-relationships.html
>
> Did you do an order.getShipments() and then add a shipment and then do
> order.getShipments() again?
>
> Thanks,
>
> /dev/mrg
Re: Faulting nested relationships
Posted by Michael Gentry <bl...@gmail.com>.
My mistake -- I thought you had hand-written a cover method in your
getShipments() method.
Is the following what might be causing your problem?
"Most of flattened relationships are treated as read-only by Cayenne.
Only one (the most commonly used) type is read/write. It is
many-to-many (n:m) flattened relationships with a single join table."
http://cayenne.apache.org/doc/cayennemodeler-flattened-relationships.html
Did you do an order.getShipments() and then add a shipment and then do
order.getShipments() again?
Thanks,
/dev/mrg
On Dec 11, 2007 3:45 PM, Kevin Menard <km...@servprise.com> wrote:
> It's a mapped relationship.
>
> Target: Shipment
> Collection Type: java.util.List
>
> Mapping to DbRelationships:
>
> orderedItems [orders -> order_entries]
> shipmentEntries [order_entries -> shipment_entries]
> shipment [shipment_entries -> shipments]
>
> Thanks,
> Kevin
>
>
>
> On 12/11/07 3:42 PM, "Michael Gentry" <bl...@gmail.com> wrote:
>
> > What does your Order#getShipments() look like?
> >
> > Thanks,
> >
> > /dev/mrg
> >
> > On Dec 11, 2007 3:37 PM, Kevin Menard <km...@servprise.com> wrote:
> >> Hi,
> >>
> >> I have a nested relationship that I can't seem to update. I have something
> >> like the following:
> >>
> >> Order ---* OrderEntry ---* ShipmentEntry ---* Shipment
> >>
> >> I added a nested relationship on Order to Shipment so I wouldn't have to
> >> manually traverse all of that.
> >>
> >> If I create a new Shipment and associate a ShipmentEntry with it that is in
> >> turn associated with an OrderEntry, a call to Order#getShipments() will not
> >> recognize the new Shipment. If I manually traverse the path, however, the
> >> data is correct. Grabbing a new context, the call to Order#getShipments()
> >> is correct.
> >>
> >> I've tried using variants of RefreshQuery to no avail. So, any help would
> >> be appreciated. This is in Cayenne 3.0-trunk in an ROP client environment.
> >>
> >> If I can't get that going, I'll just have to write my own getShipments() I
> >> guess.
> >>
> >> Thanks,
> >> Kevin
> >>
> >>
>
>
Re: Faulting nested relationships
Posted by Kevin Menard <km...@servprise.com>.
It's a mapped relationship.
Target: Shipment
Collection Type: java.util.List
Mapping to DbRelationships:
orderedItems [orders -> order_entries]
shipmentEntries [order_entries -> shipment_entries]
shipment [shipment_entries -> shipments]
Thanks,
Kevin
On 12/11/07 3:42 PM, "Michael Gentry" <bl...@gmail.com> wrote:
> What does your Order#getShipments() look like?
>
> Thanks,
>
> /dev/mrg
>
> On Dec 11, 2007 3:37 PM, Kevin Menard <km...@servprise.com> wrote:
>> Hi,
>>
>> I have a nested relationship that I can't seem to update. I have something
>> like the following:
>>
>> Order ---* OrderEntry ---* ShipmentEntry ---* Shipment
>>
>> I added a nested relationship on Order to Shipment so I wouldn't have to
>> manually traverse all of that.
>>
>> If I create a new Shipment and associate a ShipmentEntry with it that is in
>> turn associated with an OrderEntry, a call to Order#getShipments() will not
>> recognize the new Shipment. If I manually traverse the path, however, the
>> data is correct. Grabbing a new context, the call to Order#getShipments()
>> is correct.
>>
>> I've tried using variants of RefreshQuery to no avail. So, any help would
>> be appreciated. This is in Cayenne 3.0-trunk in an ROP client environment.
>>
>> If I can't get that going, I'll just have to write my own getShipments() I
>> guess.
>>
>> Thanks,
>> Kevin
>>
>>
Re: Faulting nested relationships
Posted by Michael Gentry <bl...@gmail.com>.
What does your Order#getShipments() look like?
Thanks,
/dev/mrg
On Dec 11, 2007 3:37 PM, Kevin Menard <km...@servprise.com> wrote:
> Hi,
>
> I have a nested relationship that I can't seem to update. I have something
> like the following:
>
> Order ---* OrderEntry ---* ShipmentEntry ---* Shipment
>
> I added a nested relationship on Order to Shipment so I wouldn't have to
> manually traverse all of that.
>
> If I create a new Shipment and associate a ShipmentEntry with it that is in
> turn associated with an OrderEntry, a call to Order#getShipments() will not
> recognize the new Shipment. If I manually traverse the path, however, the
> data is correct. Grabbing a new context, the call to Order#getShipments()
> is correct.
>
> I've tried using variants of RefreshQuery to no avail. So, any help would
> be appreciated. This is in Cayenne 3.0-trunk in an ROP client environment.
>
> If I can't get that going, I'll just have to write my own getShipments() I
> guess.
>
> Thanks,
> Kevin
>
>