Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 74032 invoked from network); 21 Jun 2010 14:09:57 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Jun 2010 14:09:57 -0000 Received: (qmail 90626 invoked by uid 500); 21 Jun 2010 14:09:55 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 89992 invoked by uid 500); 21 Jun 2010 14:09:54 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 89750 invoked by uid 99); 21 Jun 2010 14:09:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jun 2010 14:09:54 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HK_NAME_FM_MR_MRS,HTML_MESSAGE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mr.abanjo@gmail.com designates 74.125.82.171 as permitted sender) Received: from [74.125.82.171] (HELO mail-wy0-f171.google.com) (74.125.82.171) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jun 2010 14:09:47 +0000 Received: by wyb32 with SMTP id 32so2822174wyb.16 for ; Mon, 21 Jun 2010 07:09:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=Z+XKrAZlZWnjvBJ96J/6ly8H4+bLYOUCMDg8IcRdpQ0=; b=gqFxJTlXZySyozeC4xm3FILn/49jrXspsEisyVMnbXL+ipFbWOD27Ah2x/6dH+Jr3N akjL8B+ZdmBljHVc6adbHN0zVqF5O/fsKg/8ZdlV+TQ6w0Fs4Yqn98hG25sTViyrNfVn lOesg56isnynR3Ddu5ivaeDBYZS9lgs8GvSXw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=WriiKEsCH7rkG0OlbwRc81Z6IiokacK1HJZ28LOj8rB447lb1oT2zmCQCldoQ86C6z 2ngh+kwyGje9EkWpH2iQZyXHlt7Eywc52mEYjogAyHD5qSCgdHDl4m7+H+a+zvo3ux3n iEiMiefYqt5jIljJch6aCIR2Ei+GgPSh+U6po= MIME-Version: 1.0 Received: by 10.216.90.76 with SMTP id d54mr260289wef.83.1277129365073; Mon, 21 Jun 2010 07:09:25 -0700 (PDT) Received: by 10.216.19.206 with HTTP; Mon, 21 Jun 2010 07:09:25 -0700 (PDT) In-Reply-To: <4C0B57B4.5050107@ish.com.au> References: <6E95CB3B-E915-4B95-9FA8-39190E9A5BD1@masslight.net> <4C0B57B4.5050107@ish.com.au> Date: Mon, 21 Jun 2010 16:09:25 +0200 Message-ID: Subject: Re: Some doubts about DataContext and memory allocation From: "mr.abanjo" To: user@cayenne.apache.org Content-Type: multipart/alternative; boundary=0016e6d778dd232fde04898ada63 X-Virus-Checked: Checked by ClamAV on apache.org --0016e6d778dd232fde04898ada63 Content-Type: text/plain; charset=ISO-8859-1 You are right Aristedes. Thansk for your support! Davide On Sun, Jun 6, 2010 at 10:09 AM, Aristedes Maniatis wrote: > On 23/05/10 5:25 PM, mr.abanjo wrote: > >> The write operation i perfrom in my site is very simple. It's just an >> insert >> of two fields in a single table. So maybe also singleton should work, >> > > No, it is still going to be a bad idea. What happens in your application > when in one thread you are committing the context and an in another thread > you are in the middle of adding records to that same context? > > Don't have a context which lives across different threads until you really > know what you are doing with locking. > > There is one time that it is common to have a singleton context: a > read-only 'shared' context for displaying data. Developers from a WO > background will be familiar with this approach. Cayenne doesn't have a > special shared context, but you can use it that way if you like. > > Ari > > -- > --------------------------> > Aristedes Maniatis > 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 > --0016e6d778dd232fde04898ada63--