db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean T. Anderson" <...@bristowhill.com>
Subject Should getGeneratedKeys() return a NULL key after commit/rollback?
Date Thu, 15 Mar 2007 23:34:07 GMT
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]

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
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.



[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):

[2] This link to the master will be good even after the file is svn deleted:


View raw message