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 C1CCC685D for ; Tue, 2 Aug 2011 13:00:06 +0000 (UTC) Received: (qmail 16077 invoked by uid 500); 2 Aug 2011 13:00:06 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 16037 invoked by uid 500); 2 Aug 2011 13:00:05 -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 16023 invoked by uid 99); 2 Aug 2011 13:00:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Aug 2011 13:00:05 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.78.103.231] (HELO vorsha.objectstyle.org) (208.78.103.231) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 02 Aug 2011 12:59:57 +0000 Received: (qmail 20448 invoked from network); 2 Aug 2011 12:59:36 -0000 Received: from unknown (HELO ?192.168.1.94?) (194.158.197.10) by vorsha.objectstyle.org with SMTP; 2 Aug 2011 12:59:36 -0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) Subject: Re: CayenneRuntimeException - temporary ID not replaced From: Andrus Adamchik In-Reply-To: Date: Tue, 2 Aug 2011 15:59:34 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: user@cayenne.apache.org X-Mailer: Apple Mail (2.1084) See Wernke's reply in the previous thread. You can have a meaningful = primary key. Just manually map an ObjAttribute for it and set it in the = code. You still *must* have a designated DbEntity column marked as PK = whether it is meaningful or not. Andrus On Aug 2, 2011, at 12:29 PM, amulya rattan wrote: > All, >=20 > I am getting the following exception. >=20 > Exception in thread "main" org.apache.cayenne.CayenneRuntimeException: > [v.3.0RC2 Feb 03 2010 13:38:54] Temporary ID hasn't been replaced on = commit: > {; new; [modelId=3D>123; > meterId=3D>1234567]} >=20 > Looks like the temp id mentioned in the exception had to be replaced = by some > primary key value? But I should mention that I didn't keep any primary = key > in my table since when i do, Cayenne doesn't create a setter/getter = for it, > but I want to be able to set the primary key myself instead of Cayenne = or > database generated. I am guessing there must be a way around it. Any > pointers are appreciated. >=20 > ~Amulya