Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 40686 invoked from network); 29 Jul 2009 13:05:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 29 Jul 2009 13:05:55 -0000 Received: (qmail 14723 invoked by uid 500); 29 Jul 2009 13:05:55 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 14690 invoked by uid 500); 29 Jul 2009 13:05:55 -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 14680 invoked by uid 99); 29 Jul 2009 13:05:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jul 2009 13:05:55 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of razumovsky.andrey@gmail.com designates 209.85.218.212 as permitted sender) Received: from [209.85.218.212] (HELO mail-bw0-f212.google.com) (209.85.218.212) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jul 2009 13:05:47 +0000 Received: by bwz8 with SMTP id 8so766490bwz.4 for ; Wed, 29 Jul 2009 06:05:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=K67CEA5yVfpuTZyndgsXqGqEE9J3X9nsONN7VBu8zN8=; b=xSmzQ/B/A4Wh65O4hQVb4DWu0YHnmMo8oM6AKd8myhOlxJIk+ilgLY6ZOxcW4AUzGB HPwSwQqC3G+Q+HIAh3ze+pShsJaKRV7JXFBj4etoHjwgRMRCYAFPdMcZ8DpfMkQvjXep v/Gn7nDr0yQ3DMEgWkyFPscmMRuGG9XMLEqbU= 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=gJ7Ajv5M2SxaUB3TrZUugu6jhDM3SuU/fVuv70MrPP+Q0WV0OO6yZUTHejuGnaH6I1 wzfefallBWXF1pgMvB6JdC3CGfRX/qJYffcXFNzaKrGG4pzU80ewoPG4D/Bxge72RadF kZIBW8dl+ZMl7GqF6njZqcVktZg6SELhT0w8U= MIME-Version: 1.0 Received: by 10.223.126.69 with SMTP id b5mr4294515fas.34.1248872725609; Wed, 29 Jul 2009 06:05:25 -0700 (PDT) In-Reply-To: References: Date: Wed, 29 Jul 2009 17:05:25 +0400 Message-ID: <3219fff70907290605y6545b17eqeed08c33abe923ea@mail.gmail.com> Subject: Re: Refresh ObjectId for meaningful PK From: Andrey Razumovsky To: user@cayenne.apache.org Content-Type: multipart/alternative; boundary=001636c5a82f2dfed0046fd7d7a3 X-Virus-Checked: Checked by ClamAV on apache.org --001636c5a82f2dfed0046fd7d7a3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Manually invoking setObjectId() in the middle of CDO lifecycle isn't a good idea, because data object might have already been registered in context with another ObjectId. What CayenneRuntimeExeptions are you having and what is your version of Cayenne? 2009/7/29 Juergen Saar > Hi, > > I'm working on an 20 year old project with meaningful primary keys. > > Till now, we used cayenne only for reading but now we are working on the > first 'real' Web-Components that handle Order-Data. > > So I have to create the primary key myself. > > In the Modeller I created ObjAttributes for the PK-Fields and use the > setters to transfer the PK-Values to the Business-Object. > > In most cases this seems to work, only sometimes a CayenneRuntimeExeption > tells me some Problems about temporary ObjectIds. The Data are stored > pretty > correct in the Database Tables. > > In some cases, especially on 1:1 Relations there are Problems with the > Foreign Keys. > > So I try to setup my own ObjectId with the generated Values for the primary > Key and put this into the DataObject by setObjectId(). > > This brings the whole BusinessObject in trouble. > > Is there a correct way to solve this problem? > -Juergen- > --001636c5a82f2dfed0046fd7d7a3--