RE: Best Practices Question

From: Weddle, Anthony (Anthony.Weddl..luescopesteel.com)
Date: Mon May 04 2009 - 18:33:51 EDT

  • Next message: Borut Bolčina: "Re: 3.0 cache documentation"

    Wouldn't it be better to use a nested context for "edit mode"? Once
    committed, those changes would be visible in the shared context.

    Tony

    -----Original Message-----
    From: Aristedes Maniatis [mailto:ar..sh.com.au]
    Sent: Wednesday, 22 April 2009 12:32 p.m.
    To: use..ayenne.apache.org
    Subject: Re: Best Practices Question

    On 22/04/2009, at 6:40 AM, Ylan Segal wrote:

    > In a web app where each session has a DataContext, do I need to
    > worry about data caching in different DataContexts?

    I'd like to add just one further point. It is a common design pattern
    to create one read-only 'shared' context which is used to fetch and
    display information. This shared context lives for the life of the
    application. Then when users 'go into edit mode' whatever that means
    for your application, you create a new context for them and manage
    their changes until they save in that dedicated context.

    You need to be careful because you cannot relate two objects in
    different contexts, but it isn't hard to copy objects from one context
    to another.

    There is nothing in Cayenne which enforces a context read-only or
    'shared', it is just the manner in which you use it.

    Regards
    Ari



    This archive was generated by hypermail 2.0.0 : Mon May 04 2009 - 18:34:33 EDT