> Look at the fetch method implementation, it does similar things and
> you can probably use it as a blueprint for the exists one.
I did and think the implementation should be:
Statement statement = null;
ResultSet resultSet = null;
boolean exists = false;
try
{
statement = connection.createStatement();
resultSet = statement.executeQuery(sql.toString());
exists = resultSet.next();
resultSet.close();
}
catch (SQLException ex)
{
throw new DatabaseOperationException("Error while reading from the
database", ex);
}
finally
{
closeStatement(statement);
}
return exists;
As I have no commit rights (and as far as I know, you are currently
the only committer), committing is up to you.