Re: Unique persistent object and caching issue

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Jul 15 2008 - 09:55:13 EDT

  • Next message: Laurent Marchal: "Re: Unique persistent object and caching issue"

    On Jul 15, 2008, at 4:49 PM, Laurent Marchal wrote:

    > But the thing I don't understand is why when i refetch the Artist
    > object the relationships are not invalidated.

    By default only the object itself is refreshed. Cayenne has no way of
    knowing which part of the object graph has changed, so this is
    something a user must tell it.

    > Is Cayenne considering that the relationships of Artist are still
    > good even if the Artist snapshot version changed ?
    > Must i do a RefreshQuery for each of my SelectQueries to be sure the
    > data in cayenne correspond to the database ?

    No. You need to use prefetching on this relationship in the
    SelectQuery, and then the related list will be fetched and refreshed
    together with the root object.

    query.addPrefetch("gelatedArtistAux");

    Andrus



    This archive was generated by hypermail 2.0.0 : Tue Jul 15 2008 - 09:55:47 EDT