@Test public void testGetFirstResult() throws Exception { Dao<Foo, Integer> dao = createDao(Foo.class, true); Foo foo1 = new Foo(); foo1.val = 342; assertEquals(1, dao.create(foo1)); Foo foo2 = new Foo(); foo2.val = 9045342; assertEquals(1, dao.create(foo2)); QueryBuilder<Foo, Integer> qb = dao.queryBuilder(); qb.selectRaw("MAX(" + Foo.VAL_COLUMN_NAME + ")"); GenericRawResults<String[]> results = dao.queryRaw(qb.prepareStatementString()); String[] result = results.getFirstResult(); int max = Integer.parseInt(result[0]); if (foo1.val > foo2.val) { assertEquals(foo1.val, max); } else { assertEquals(foo2.val, max); } }
@Override public T getFirstResult() throws SQLException { try { if (iterator.hasNextThrow()) { return iterator.nextThrow(); } else { return null; } } finally { IOUtils.closeThrowSqlException(this, "raw results iterator"); } }
RawResultsImpl implements GenericRawResults<T> { @Override public T getFirstResult() throws SQLException { try { if (iterator.hasNextThrow()) { return iterator.nextThrow(); } else { return null; } } finally { IOUtils.closeThrowSqlException(this, "raw results iterator"); } } }
RawResultsImpl implements GenericRawResults<T> { @Override public T getFirstResult() throws SQLException { try { if (iterator.hasNextThrow()) { return iterator.nextThrow(); } else { return null; } } finally { IOUtils.closeThrowSqlException(this, "raw results iterator"); } } RawResultsImpl(ConnectionSource connectionSource, DatabaseConnection connection, String query,
			Class<?> clazz, CompiledStatement compiledStmt, GenericRowMapper<T> rowMapper, ObjectCache objectCache); }
RawResultsImpl implements GenericRawResults<T> { @Override public T getFirstResult() throws SQLException { try { if (iterator.hasNextThrow()) { return iterator.nextThrow(); } else { return null; } } finally { IOUtils.closeThrowSqlException(this, "raw results iterator"); } } RawResultsImpl(ConnectionSource connectionSource, DatabaseConnection connection, String query,
			Class<?> clazz, CompiledStatement compiledStmt, GenericRowMapper<T> rowMapper, ObjectCache objectCache); @Override int getNumberColumns(); @Override String[] getColumnNames(); @Override List<T> getResults(); @Override T getFirstResult(); @Override CloseableIterator<T> iterator(); @Override CloseableIterator<T> closeableIterator(); @Override void close(); }
RawResultsImpl implements GenericRawResults<T> { @Override public T getFirstResult() throws SQLException { try { if (iterator.hasNextThrow()) { return iterator.nextThrow(); } else { return null; } } finally { IOUtils.closeThrowSqlException(this, "raw results iterator"); } } RawResultsImpl(ConnectionSource connectionSource, DatabaseConnection connection, String query,
			Class<?> clazz, CompiledStatement compiledStmt, GenericRowMapper<T> rowMapper, ObjectCache objectCache); @Override int getNumberColumns(); @Override String[] getColumnNames(); @Override List<T> getResults(); @Override T getFirstResult(); @Override CloseableIterator<T> iterator(); @Override CloseableIterator<T> closeableIterator(); @Override void close();  }