On Apr 28, 2006, at 3:55 AM, Marcin Skladaniec wrote:
> Hello
>
> I have two contexts containing the same entity.
> - one contains the list of all entities of this type - ListContext
> - second contains only one entity for editing - EditContext
>
> I would like to notify the relevant context(s) when the object
> changes, so it needs to be refreshed.
Hmm... If those two contexts use the same ClientChannel,
synchronization should be automatic. Of course it only happens on
commit.
> How can I do it ? I thought there was a notification mechanism in
> 3t-cayenne, but I cant find a word about it anymore.
The even mechanism was simplified (you may say downgraded) compared
to the earlier version. I need to updated the docs. You can listen to
the ClientChannel events. To register a listener implement
DataChannelListener and use EventUtil class to register it.
If you need to receive ongoing object events (i.e. property changes
that by themselves do not result in commit), you can subclass
CayenneContext and override 'propertyChanged'
> What is the best way to force object to be re-faulted from
> database ? I tried to set persistence state to hollow but it does
> not work.
Yeah, unfortunately client invalidate functionality didn't make it to
1.2. One way to work around this is an explicit refresh query:
Query q = new ObjectIdQuery(oid, false, ObjectIdQuery.CACHE_REFRESH)
Andrus
This archive was generated by hypermail 2.0.0 : Fri Apr 28 2006 - 08:38:19 EDT