Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 42209 invoked from network); 12 Aug 2010 14:42:44 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 Aug 2010 14:42:44 -0000 Received: (qmail 70531 invoked by uid 500); 12 Aug 2010 14:42:44 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 70303 invoked by uid 500); 12 Aug 2010 14:42:42 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 70295 invoked by uid 99); 12 Aug 2010 14:42:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Aug 2010 14:42:41 +0000 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=SPF_HELO_PASS,SPF_NEUTRAL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Aug 2010 14:42:35 +0000 Received: from jim.nabble.com ([192.168.236.80]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1OjYz0-0003YX-4a for users@openjpa.apache.org; Thu, 12 Aug 2010 07:42:14 -0700 Date: Thu, 12 Aug 2010 07:42:14 -0700 (PDT) From: nicolas13 To: users@openjpa.apache.org Message-ID: <1281624134133-5416352.post@n2.nabble.com> In-Reply-To: References: <1281538387372-5412600.post@n2.nabble.com> <1281545024772-5413035.post@n2.nabble.com> <1281600457736-5415269.post@n2.nabble.com> Subject: Re: Cannot get primary key value (mysql) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit >I'm going to ask the obvious.... as you guessed, i'm a newbe... your question is legitimate :-) >but is the id column in your db named idMigration? Yep. The strange thing (to me, i guess there must be a obvious reason i'm failing to understand) is that if i put the @Id annotation on another field of my entity, specifying the column like that: ------------------------------- @Id @Column(name="idMigration") private int id; private int idMigration; ------------------------------ it works as i expected: idMigration is loaded like a regular column. Is there any reason why i my primary key is not loaded like the other fields? thanks for you help. >Another thing, I see you are using @GeneratedValue(strategy= >GenerationType.AUTO) for your id... but I assume you want to use the MySQL >AUTO_INCREMENT function? If so, change GenerationType.AUTO to >GenerationType.IDENTITY. Ok, thanks for the advice. -- View this message in context: http://openjpa.208410.n2.nabble.com/Cannot-get-primary-key-value-mysql-tp5412600p5416352.html Sent from the OpenJPA Users mailing list archive at Nabble.com.