Re: Best Practices Question

From: Aristedes Maniatis (ar..sh.com.au)
Date: Tue Apr 21 2009 - 20:32:23 EDT

  • Next message: Joseph Schmidt: "Re: "Can't get primary key from temporary id" :("

    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

    -------------------------->
    ish
    http://www.ish.com.au
    Level 1, 30 Wilson Street Newtown 2042 Australia
    phone +61 2 9550 5001 fax +61 2 9550 4001
    GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A



    This archive was generated by hypermail 2.0.0 : Tue Apr 21 2009 - 20:33:08 EDT