I use following code to retrieve the id. Although it returns the same and correct id, the while loop is executed multiple times after multiple rows are inserted. Is it a bug?
 
ResultSet rs = statement.executeQuery("select IDENTITY_VAL_LOCAL() from APP.Students");
while(rs.next())
{
     id = rs.getInt(1);
}

 
On 7/26/06, Paul J DeCoursey <paul@decoursey.net> wrote:
Hong Ji wrote:
> With JDBC and Derby, how to get the id of the newly inserted record?
SELECT IDENTITY_VAL_LOCAL() FROM ...