@@ -747,6 +747,12 @@ public SafeSql orElse(Supplier<SafeSql> fallback) {
747747 * record User(@SqlName("id") long id, @SqlName("name") String name) {...}
748748 * }</pre>
749749 *
750+ * <p>Alternatively, if your query only selects one column, you could also use this method
751+ * to read the results: <pre>{@code
752+ * List<String> names = SafeSql.of("SELECT name FROM Users WHERE name LIKE '%{name}%'", name)
753+ * .query(connection, String.class);
754+ * }</pre>
755+ *
750756 *
751757 * @throws UncheckedSqlException wraps {@link SQLException} if failed
752758 * @since 8.7
@@ -818,6 +824,14 @@ public <T> List<T> query(
818824 * record User(@SqlName("id") long id, @SqlName("name") String name) {...}
819825 * }</pre>
820826 *
827+ * <p>Alternatively, if your query only selects one column, you could also use this method
828+ * to read the results: <pre>{@code
829+ * SafeSql sql = SafeSql.of("SELECT id FROM Users WHERE name LIKE '%{name}%'", name);
830+ * try (Stream<Long> ids = sql.queryLazily(connection, Long.class)) {
831+ * return ids.findFirst();
832+ * }
833+ * }</pre>
834+ *
821835 * @throws UncheckedSqlException wraps {@link SQLException} if failed
822836 * @since 8.7
823837 */
@@ -866,7 +880,7 @@ public <T> Stream<T> queryLazily(
866880 *
867881 * <p>For example: <pre>{@code
868882 * SafeSql sql = SafeSql.of("SELECT id, name FROM Users WHERE name LIKE '%{name}%'", name);
869- * try (Stream<User> users = sql.queryLazily(connection, User.class)) {
883+ * try (Stream<User> users = sql.queryLazily(connection, fetchSize, User.class)) {
870884 * return users.findFirst();
871885 * }
872886 *
@@ -885,6 +899,14 @@ public <T> Stream<T> queryLazily(
885899 * record User(@SqlName("id") long id, @SqlName("name") String name) {...}
886900 * }</pre>
887901 *
902+ * <p>Alternatively, if your query only selects one column, you could also use this method
903+ * to read the results: <pre>{@code
904+ * SafeSql sql = SafeSql.of("SELECT birthday FROM Users WHERE name LIKE '%{name}%'", name);
905+ * try (Stream<LocalDate> birthdays = sql.queryLazily(connection, fetchSize, LocalDate.class)) {
906+ * return birthdays.findFirst();
907+ * }
908+ * }</pre>
909+ *
888910 * @throws UncheckedSqlException wraps {@link SQLException} if failed
889911 * @since 8.7
890912 */
0 commit comments