Return-Path: Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 93777 invoked from network); 28 Feb 2003 14:50:17 -0000 Received: from www3.kc.aoindustries.com (209.15.201.111) by daedalus.apache.org with SMTP; 28 Feb 2003 14:50:17 -0000 Received: from ericemminger.com (163-44.9-67.se.rr.com [67.9.44.163] (may be forged)) (authenticated) by www3.kc.aoindustries.com (8.11.6/8.11.6) with ESMTP id h1SEoJJ04350 for ; Fri, 28 Feb 2003 08:50:19 -0600 Message-ID: <3E5F771B.2030306@ericemminger.com> Date: Fri, 28 Feb 2003 09:50:03 -0500 From: Eric Emminger User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030210 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Turbine Torque Users List Subject: Re: obtaining native primary keys problem References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Glen If I'm reading your code correctly, your method public void insert(String filename) is on Pac. Is that right? The reason your code isn't working is that the "insert" instance of Pac in the insert() method is a local variable. So, when you call test.insert("blah"); test.getPrimaryKey(); getPrimaryKey() returns 0 because it is 0. You can fix this by changing your method signature to return an int value of the new primary key. public int insert(String filename) { Pac insert = new Pac(); try { insert.setFilename(filename); insert.save(); } catch (Exception e) { e.printStackTrace(); } return insert.getPrimaryKey(); } Does that help? Eric