cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Weddle, Anthony" <>
Subject RE: Best Practices Question
Date Mon, 04 May 2009 22:33:51 GMT
Wouldn't it be better to use a nested context for "edit mode"? Once
committed, those changes would be visible in the shared context.


-----Original Message-----
From: Aristedes Maniatis [] 
Sent: Wednesday, 22 April 2009 12:32 p.m.
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.


View raw message