class DBQueries {

    public static <K> java.sql.ResultSet getIndexEntryByObjectKey(final K key , final String tableName, final Connection connection){
        final String selectSql = String.format("SELECT objectKey, value FROM cqtbl_%s WHERE objectKey = ?",tableName);
        PreparedStatement statement = null;
        try{
            statement = connection.prepareStatement(selectSql);
            DBUtils.setValueToPreparedStatement(1, statement, key);
            return statement.executeQuery();
        }catch(Exception e){
            DBUtils.closeQuietly(statement);
            throw new IllegalStateException("Unable to look up index entries.", e);
        }
        // In case of success we leave the statement and result-set open because the iteration of an Index ResultSet is lazy.

    }

}