[ http://issues.apache.org/jira/browse/DERBY-1812?page=comments#action_12433277 ] Daniel John Debrunner commented on DERBY-1812: ----------------------------------------------
My guess here is that the ResultSet returned for generated keys is of type TYPE_FORWARD_ONLY, and first() method is not allowed on a forward only result set. Can you try using rs.next()? > getGeneratedKeys() returns something weird > ------------------------------------------ > > Key: DERBY-1812 > URL: http://issues.apache.org/jira/browse/DERBY-1812 > Project: Derby > Issue Type: Bug > Components: JDBC > Affects Versions: 10.1.3.1 > Environment: java version "1.4.2-03" > Java(TM) 2 Runtime Environment, Standard Edition (build Blackdown-1.4.2-03) > Java HotSpot(TM) Client VM (build Blackdown-1.4.2-03, mixed mode) > Reporter: Stephan Fuhrmann > > After executing in embedded the cmd > int count=stat.executeUpdate("INSERT INTO > ...",Statement.RETURN_GENERATED_KEYS); > the stat.getGeneratedKeys() returns a non-null ResultSet. The result set meta > data says the result set has one column named "1". > Calling first() on this result set throws an exception telling something > about a cursor that can't be set ... I guess it's better to return FALSE in > case of calling first, because the API doc of getGeneratedKeys says: > "Retrieves any auto-generated keys created as a result of executing this > Statement object. If this Statement object did not generate any keys, an > empty ResultSet object is returned." > An empty result set would return rs.first() == false. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
