Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 54710 invoked from network); 15 Mar 2007 23:34:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Mar 2007 23:34:41 -0000 Received: (qmail 32462 invoked by uid 500); 15 Mar 2007 23:34:44 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 32415 invoked by uid 500); 15 Mar 2007 23:34:44 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 32406 invoked by uid 99); 15 Mar 2007 23:34:44 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Mar 2007 16:34:44 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of jta@bristowhill.com designates 66.75.162.134 as permitted sender) Received: from [66.75.162.134] (HELO ms-smtp-02.socal.rr.com) (66.75.162.134) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Mar 2007 16:34:32 -0700 Received: from [192.168.1.102] (cpe-24-25-218-26.san.res.rr.com [24.25.218.26]) by ms-smtp-02.socal.rr.com (8.13.6/8.13.6) with ESMTP id l2FNYApN021396 for ; Thu, 15 Mar 2007 16:34:10 -0700 (PDT) Message-ID: <45F9D7EF.1080806@bristowhill.com> Date: Thu, 15 Mar 2007 16:34:07 -0700 From: "Jean T. Anderson" Reply-To: jta@bristowhill.com User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Derby Development Subject: Should getGeneratedKeys() return a NULL key after commit/rollback? X-Enigmail-Version: 0.93.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Virus-Checked: Checked by ClamAV on apache.org I'm converting the autoGeneratedJdbc30.java test to Junit (DERBY-2398) and the original writer of that test embedded comments questioning some behavior, which I thought I'd raise here. I included links down below for the original code [1] and one of the [2] masters. Test 11 in the original does this sequence involving a commit: 1) inserts a row into a table that has an auto-generated column 2) does a commit 3) inserts into a table that does not have an auto-generated column, and specifies RETURN_GENERATED_KEYS 4) getGeneratedKeys() returns a non-NULL key. The code outputs this comment: System.out.println("expected to see resultset with one row of NULL value but instead get one row of non-NULL value from getGeneratedKeys"); Test 12 in the original does the same sequence, but with a rollback, and it has the same non-NULL result (and same comment about "expected to see resultset with one row of NULL value ...."). Is this behavior correct? Is there a resource I can consult to verify correct behavior? --I checked the API specs for getGeneratedKeys [3] and didn't find details. thanks, -jean [1] This link to the source code will be good even after the file is svn deleted (i.e., links in this email will remain good): http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/autoGeneratedJdbc30.java?revision=515102&view=markup [2] This link to the master will be good even after the file is svn deleted: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/autoGeneratedJdbc30.out?revision=429425&view=markup [3] http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html#getGeneratedKeys()