diff --git a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClient.java b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClient.java index cf2eabec9e3c..ef6ffc9330e6 100644 --- a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClient.java +++ b/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClient.java @@ -85,34 +85,43 @@ public interface DatabaseClient { /** * Returns a context in which a single read can be performed using {@link TimestampBound#strong()} - * concurrency. + * concurrency. This method will return a {@link ReadContext} that will not return the read + * timestamp that was used by Cloud Spanner. If you want to be able to access the read timestamp, + * you should use the method {@link #singleUseReadOnlyTransaction()}. * *
Example of single use. * - *
{@code - * long singerId = my_singer_id; - * String column = "FirstName"; - * Struct row = - * dbClient.singleUse().readRow("Singers", Key.of(singerId), Collections.singleton(column)); - * String firstName = row.getString(column); - * }+ *
+ * { + * @code + * long singerId = my_singer_id; + * String column = "FirstName"; + * Struct row = + * dbClient.singleUse().readRow("Singers", Key.of(singerId), Collections.singleton(column)); + * String firstName = row.getString(column); + * } + **/ ReadContext singleUse(); /** - * Returns a context in which a single read can be performed at the given timestamp bound. + * Returns a context in which a single read can be performed at the given timestamp bound. This + * method will return a {@link ReadContext} that will not return the read timestamp that was used + * by Cloud Spanner. If you want to be able to access the read timestamp, you should use the + * method {@link #singleUseReadOnlyTransaction()}. * *
Example of single use with timestamp bound. * - *
{@code - * long singerId = my_singer_id; - * String column = "FirstName"; - * Struct row = - * dbClient - * .singleUse(TimestampBound.ofMaxStaleness(10, TimeUnit.SECONDS)) - * .readRow("Singers", Key.of(singerId), Collections.singleton(column)); - * String firstName = row.getString(column); - * }+ *
+ * { + * @code + * long singerId = my_singer_id; + * String column = "FirstName"; + * Struct row = dbClient.singleUse(TimestampBound.ofMaxStaleness(10, TimeUnit.SECONDS)) + * .readRow("Singers", Key.of(singerId), Collections.singleton(column)); + * String firstName = row.getString(column); + * } + ** * @param bound the timestamp bound at which to perform the read */