Return-Path: X-Original-To: apmail-cayenne-commits-archive@www.apache.org Delivered-To: apmail-cayenne-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BD60BDCC0 for ; Thu, 6 Dec 2012 18:25:20 +0000 (UTC) Received: (qmail 25066 invoked by uid 500); 6 Dec 2012 18:25:20 -0000 Delivered-To: apmail-cayenne-commits-archive@cayenne.apache.org Received: (qmail 24076 invoked by uid 500); 6 Dec 2012 18:25:17 -0000 Mailing-List: contact commits-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list commits@cayenne.apache.org Received: (qmail 24027 invoked by uid 99); 6 Dec 2012 18:25:16 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Dec 2012 18:25:16 +0000 Date: Thu, 6 Dec 2012 18:25:16 +0000 (UTC) From: "Andrus Adamchik (JIRA)" To: commits@cayenne.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Closed] (CAY-1777) Object context's localobject method, unexpected results on new object MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAY-1777?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] Andrus Adamchik closed CAY-1777. -------------------------------- Resolution: Implemented Hi Manuel, In 3.0.x 'localObject' was used internally by Cayenne to pass objects betwe= en parent and child contexts in a nesting hierarchy, as well as exposed as = a public API. So the behavior was somewhat convoluted as it tried to addres= s a set of contradictory expectations. Since 3.1 'localObject' is intended for end users only (internal algorithms= were redone differently) and it features a much easier to understand behav= ior - it tries to locate a local object by ObjectId (regardless of the orig= inal object state), if it is not there - creates a HOLLOW object. If a user= tries to further access the HOLLOW object, it is either resolved from DB o= r parent context, or an exception is thrown. Hopefully that makes it much more consistent. =20 > Object context's localobject method, unexpected results on new object > --------------------------------------------------------------------- > > Key: CAY-1777 > URL: https://issues.apache.org/jira/browse/CAY-1777 > Project: Cayenne > Issue Type: Bug > Components: Core Library > Affects Versions: 3.0.1 > Environment: Ubuntu 12.04 > Reporter: Manuel S=C3=A1nchez > Priority: Minor > > A just new persistent object, persitence status =3D NEW, gets COMMITTED i= f you change it from object context. > MyClass o=3D objectContext.newObject( MyClass.class) > -> o persistence status=3D NEW > o2=3D objectContext2.localObject( o.getObjectId(), o) > -> o2 persistence status=3D COMMITTED=20 > It seems more suitable to return o2 in NEW persistence status. > I know this is a consequence of some bad design, i changed it. Just tryin= g to help the framework gives the expected results. > Thanks for you great work, i enjoy using CAY! > =20 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira