Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 89172 invoked from network); 14 Apr 2011 01:30:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Apr 2011 01:30:39 -0000 Received: (qmail 79273 invoked by uid 500); 14 Apr 2011 01:30:39 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 79251 invoked by uid 500); 14 Apr 2011 01:30:39 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 79242 invoked by uid 99); 14 Apr 2011 01:30:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Apr 2011 01:30:39 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.210.174] (HELO mail-iy0-f174.google.com) (209.85.210.174) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Apr 2011 01:30:33 +0000 Received: by iyb14 with SMTP id 14so1439140iyb.33 for ; Wed, 13 Apr 2011 18:30:13 -0700 (PDT) Received: by 10.231.141.141 with SMTP id m13mr127674ibu.148.1302744612512; Wed, 13 Apr 2011 18:30:12 -0700 (PDT) Received: from [10.0.1.90] (203-114-161-15.wir.sta.inspire.net.nz [203.114.161.15]) by mx.google.com with ESMTPS id 13sm806495ibo.8.2011.04.13.18.30.10 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Apr 2011 18:30:11 -0700 (PDT) Sender: Todd Nine Subject: Re: Possible bug in Statemanager.fetchObjectId() with Entity Id fields in composite id and application assigned identities? Appears to be flush cascade related. From: Todd Nine Reply-To: todd@spidertracks.com To: dev Cc: Nate McCall In-Reply-To: <1302741730.3021.38.camel@greenlantern> References: <1302741730.3021.38.camel@greenlantern> Content-Type: multipart/alternative; boundary="=-ZmfjY4Eep9msodbUJelM" Organization: Spidertracks Date: Thu, 14 Apr 2011 13:30:03 +1200 Message-ID: <1302744603.3021.40.camel@greenlantern> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 --=-ZmfjY4Eep9msodbUJelM Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Hi all, Because this has broken my build I've started fixing this issue on a separate branch. You can view this branch here. https://github.com/riptano/hector-jpa/tree/compositeentityid On Thu, 2011-04-14 at 12:42 +1200, Todd Nine wrote: > Hi guys, > I've read the JPA spec several times, as well as section 4.2 in the > 2.1.0 documentation and I believe I've mapped this relationship > correctly. > > https://github.com/riptano/hector-jpa/blob/master/src/test/java/com/datastax/hectorjpa/bean/Observe.java > > I'm hitting what seems to be a bug in the internal OpenJPAStateManager > api. This is essentially what I thought would occur on flush. > > 1. User target is assigned their OID via the generator > 2. User owner is assigne their OID via the generator > 3. A call to StateManager.fetchObjectId() on a statemanager for the > Observe class will return an instance of Observe.ObserveId with both > the owner UUID and the target UUID populated since it will internally > invoke assignObjectId(true) > > > What I'm seeing instead > > 1. User instance "target" is assigned an OID > 2. User instance "owner" is assigned an OID. > 3. Subsequent calls to StateManager.fetchObjectId() return an OID > instance with either both fields null, or a single field populated > depending on the instance that's getting flushed. For instance, if > I'm saving the User and cascading the observing, the "owner" uuid will > be populated but the "target" will not. > > > Am I doing something incorrectly? The files that are causing the > issues are here. > > https://github.com/riptano/hector-jpa/blob/master/src/main/java/com/datastax/hectorjpa/store/EntityFacade.java line 374. When an Observe is flushed both ID's are null, even though the relationship graph is correctly constructed. > > > https://github.com/riptano/hector-jpa/blob/master/src/main/java/com/datastax/hectorjpa/meta/collection/OrderedCollectionField.java line 341. In this case, only 1 of the 2 Ids are assigned. It seems to be assigning the entity that owns the field in the composite Id, but not the other id. > > > > It appears that cascading the flush to embedded Id entities is not > working correctly in my current usage. Am I doing something > incorrectly, or is this a bug? > > Thanks, > > Todd > > > > > > > > --=-ZmfjY4Eep9msodbUJelM--