diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/JdbcClient.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/JdbcClient.java
index 326938df90ee..d8b4f7b3cd0b 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/JdbcClient.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/simple/JdbcClient.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2023 the original author or authors.
+ * Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -343,12 +343,26 @@ interface ResultQuerySpec {
/**
* Retrieve a single value result.
- * @return the single row represented as its single column value
+ *
Note: As of 6.2, this will enforce non-null result values
+ * as originally designed (just accidentally not enforced before).
+ * (never {@code null})
+ * @see #optionalValue()
* @see DataAccessUtils#requiredSingleResult(Collection)
*/
default Object singleValue() {
return DataAccessUtils.requiredSingleResult(singleColumn());
}
+
+ /**
+ * Retrieve a single value result, if available, as an {@link Optional} handle.
+ * @return an Optional handle with the single column value from the single row
+ * @since 6.2
+ * @see #singleValue()
+ * @see DataAccessUtils#optionalResult(Collection)
+ */
+ default Optional