Skip to content

Commit 7ecb3af

Browse files
committed
JAVA-1810: Note which setters are not propagated to PreparedStatement
1 parent 598c5cb commit 7ecb3af

3 files changed

Lines changed: 22 additions & 4 deletions

File tree

changelog/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- [bug] JAVA-1935: Add null check in QueryConsistencyException.getHost.
1919
- [improvement] JAVA-1771: Send driver name and version in STARTUP message.
2020
- [improvement] JAVA-1388: Add dynamic port discovery for system.peers\_v2.
21+
- [documentation] JAVA-1810: Note which setters are not propagated to PreparedStatement.
2122

2223
Merged from 3.5.x:
2324

driver-core/src/main/java/com/datastax/driver/core/Session.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,14 @@ public interface Session extends Closeable {
249249
/**
250250
* Prepares the provided query.
251251
*
252-
* <p>This method behaves like {@link #prepare(String)}, but note that the resulting {@code
253-
* PreparedStatement} will inherit the query properties set on {@code statement}. Concretely, this
254-
* means that in the following code:
252+
* <p>This method behaves like {@link #prepare(String)}, but the resulting {@code
253+
* PreparedStatement} will inherit some of the properties set on {@code statement}: {@linkplain
254+
* Statement#getRoutingKey(ProtocolVersion, CodecRegistry) routing key}, {@linkplain
255+
* Statement#getConsistencyLevel() consistency level}, {@linkplain
256+
* Statement#getSerialConsistencyLevel() serial consistency level}, {@linkplain
257+
* Statement#isTracing() tracing flag}, {@linkplain Statement#getRetryPolicy() retry policy},
258+
* {@linkplain Statement#getOutgoingPayload() outgoing payload}, and {@linkplain
259+
* Statement#isIdempotent() idempotence}. Concretely, this means that in the following code:
255260
*
256261
* <pre>
257262
* RegularStatement toPrepare = new SimpleStatement("SELECT * FROM test WHERE k=?").setConsistencyLevel(ConsistencyLevel.QUORUM);

driver-core/src/main/java/com/datastax/driver/core/Statement.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,10 @@ public RetryPolicy getRetryPolicy() {
252252
* value in practice as it will yield very poor performance. If in doubt, leaving the default is
253253
* probably a good idea.
254254
*
255-
* <p>Only {@code SELECT} queries only ever make use of that setting.
255+
* <p>Only {@code SELECT} queries only ever make use of this setting.
256+
*
257+
* <p>Note that unlike other configuration, when this statement is prepared {@link
258+
* BoundStatement}s created off of {@link PreparedStatement} do not inherit this configuration.
256259
*
257260
* <p>Note: Paging is not supported with the native protocol version 1. If you call this method
258261
* with {@code fetchSize &gt; 0} and {@code fetchSize != Integer.MAX_VALUE} and the protocol
@@ -299,6 +302,9 @@ public int getFetchSize() {
299302
* If none of these apply, no timestamp will be sent with the query and Cassandra will generate a
300303
* server-side one (similar to the pre-V3 behavior).
301304
*
305+
* <p>Note that unlike other configuration, when this statement is prepared {@link
306+
* BoundStatement}s created off of {@link PreparedStatement} do not inherit this configuration.
307+
*
302308
* @param defaultTimestamp the default timestamp for this query (must be strictly positive).
303309
* @return this {@code Statement} object.
304310
* @see Cluster.Builder#withTimestampGenerator(TimestampGenerator)
@@ -324,6 +330,9 @@ public long getDefaultTimestamp() {
324330
* <p>You should override this only for statements for which the coordinator may allow a longer
325331
* server-side timeout (for example aggregation queries).
326332
*
333+
* <p>Note that unlike other configuration, when this statement is prepared {@link
334+
* BoundStatement}s created off of {@link PreparedStatement} do not inherit this configuration.
335+
*
327336
* @param readTimeoutMillis the timeout to set. Negative values are not allowed. If it is 0, the
328337
* read timeout will be disabled for this statement.
329338
* @return this {@code Statement} object.
@@ -628,6 +637,9 @@ public Host getHost() {
628637
* distance {@link HostDistance#IGNORED} or there is no active connectivity to the host, the
629638
* request will fail with a {@link NoHostAvailableException}.
630639
*
640+
* <p>Note that unlike other configuration, when this statement is prepared {@link
641+
* BoundStatement}s created off of {@link PreparedStatement} do not inherit this configuration.
642+
*
631643
* @param host The host that should be used to handle executions of this statement or null to
632644
* delegate to the configured load balancing policy.
633645
* @return this {@code Statement} object.

0 commit comments

Comments
 (0)