Fix: Invalid operation for forward only resultset : first

Use ResultSet#next() insteadof using ResultSet#first().

As mentioned in Javadoc for ResultSet#first():

This method is called on a closed result set or the result set type is
TYPE_FORWARD_ONLY exception SQLFeatureNotSupportedException if the JDBC
driver does not support this method.

Bug: Issue 10018
Change-Id: Ica6c72f2d489520ae367b608867f5b8c6a5ef276
This commit is contained in:
David Ostrovsky
2018-11-14 17:46:38 -08:00
parent d4d41ee60c
commit f0a3fba49a
2 changed files with 2 additions and 2 deletions

View File

@@ -60,7 +60,7 @@ public class Schema_151 extends SchemaVersion {
PreparedStatement addedOnRetrieval, AccountGroup.Id groupId) throws SQLException {
addedOnRetrieval.setInt(1, groupId.get());
try (ResultSet resultSet = addedOnRetrieval.executeQuery()) {
if (resultSet.first()) {
if (resultSet.next()) {
return Optional.of(resultSet.getTimestamp(1));
}
}

View File

@@ -59,7 +59,7 @@ public class Schema_87 extends SchemaVersion {
PreparedStatement uuidRetrieval, AccountGroup.Id id) throws SQLException {
uuidRetrieval.setInt(1, id.get());
try (ResultSet uuidResults = uuidRetrieval.executeQuery()) {
if (uuidResults.first()) {
if (uuidResults.next()) {
Optional.of(new AccountGroup.UUID(uuidResults.getString(1)));
}
}