Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4B3EC275C for ; Wed, 27 Apr 2011 15:17:11 +0000 (UTC) Received: (qmail 11784 invoked by uid 500); 27 Apr 2011 15:17:11 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 11763 invoked by uid 500); 27 Apr 2011 15:17:11 -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 11754 invoked by uid 99); 27 Apr 2011 15:17:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Apr 2011 15:17:11 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mkienenb@gmail.com designates 74.125.82.47 as permitted sender) Received: from [74.125.82.47] (HELO mail-ww0-f47.google.com) (74.125.82.47) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Apr 2011 15:17:04 +0000 Received: by wwk4 with SMTP id 4so1874735wwk.28 for ; Wed, 27 Apr 2011 08:16:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=ZLqe13NoeCKZ66XiauBgWwHXMPH3Ti1/54Pm1mqxR/I=; b=UNX/Spa/mPMUpucCABHhixDBujC5tR+HXwRwrvYJ17dIj0/MXlGoxeOA6ERAe9Nhke Igmn/NkJL0HN3OV65jaulZ4Ir9Adpzrd0OE+xRgU7ddvNoyi0MdF0i3pl2b1W6jUussx gn7qobrC83s3fsll9GbvZjIKIn02VAxdh6ei4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=GjgX2VAmCFJ3uGuQdv5bmFZuHwLkKg+WS8SFVaRAm8YpKLcSJI9GUO7qZqc4IEUgYE h1D8EAJWfa5ddE8qscZyxKZtp79iVSbo3ywWIEO76RGS/GXEsLOPjHtOjppMVCsM1jzU zUvlC2q+zVac+KCa+edFWAqN+lN7pW9VcdMVk= Received: by 10.216.191.208 with SMTP id g58mr2166789wen.85.1303917404080; Wed, 27 Apr 2011 08:16:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.159.202 with HTTP; Wed, 27 Apr 2011 08:16:24 -0700 (PDT) In-Reply-To: <1303916064507-2870619.post@n3.nabble.com> References: <1303907767164-2870230.post@n3.nabble.com> <1303916064507-2870619.post@n3.nabble.com> From: Mike Kienenberger Date: Wed, 27 Apr 2011 11:16:24 -0400 Message-ID: Subject: Re: commit all objects, temporary objects, POJO's, DTO To: user@cayenne.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org You're going to have to give us more information before we can speculate on what's the best choice. It may be that a combination of several approaches make sense for your current project. I've used a number of approaches in the past. For example..... On one struts project, I created a per-session data context but only made changes to it per request. At the end of every request, the data context contained committed "read-only" objects. The changes were either committed or rolled back by the end of the request. Similar to your DTO approach , except that the persisted-between-request values were persisted as separate items. For a JSF project, I used a per-request data context, but serialized all modified-but-uncommitted data objects and unserialized them to the next per-request data context. No DTO here -- the Cayenne Objects were used at every layer. What you do depends on how long you need to keep modified or cached objects around (only one request (requeest scope), between requests ("page" scope), the lifetime of the session (session scope), the lifetime of the application (application scope). There's nothing stopping you from using a combination of choices. For some things, create a data context on demand. For other things, use a session-scoped data context. On Wed, Apr 27, 2011 at 10:54 AM, felix wrote: > Thanks for your quick response. > > It seems like we have two options: > - Create a context per writeable action (otherwise we could not retrieve an > object, updated and save exactly when we want, in other words, when the obj > is in a consistent state) > - Create a DTO layer and have for instance one context per session. The most > flexible option so far. > > I have heard there is something related to POJOs in Cayenne, Could I have > more information regarding this point (I've tried but no much info on this)? > > Thanks a lot > > > -- > View this message in context: http://cayenne.195.n3.nabble.com/commit-all-objects-temporary-objects-POJO-s-DTO-tp2870230p2870619.html > Sent from the Cayenne - User mailing list archive at Nabble.com. >