Reputation: 3898
Datastax's java driver for cassandra provides Accessor. Refer here
With reference to their example as below, do they do pagination and fetch records in batches or is there a risk of the queries timing out ?
@Accessor
public interface UserAccessor {
@Query("SELECT * FROM user")
Result<User> getAll();
}
When I say pagination, do they internally do something similar to below
Statement stmt = new SimpleStatement("SELECT * FROM user");
stmt.setFetchSize(24);
ResultSet rs = session.execute(stmt);
Upvotes: 3
Views: 772
Reputation: 4782
Here is an example of how I am using the fetchSize in the @QueryParameters annotation within an Accessor:
@Accessor
public interface UserAccessor {
@Query("SELECT * FROM users")
@QueryParameters(fetchSize = 1000)
Result<User> getAllUsers();
}
Upvotes: 2
Reputation: 3938
Yes there is a fetch size used behind the scenes. The driver will auto page for you as needed.
You will probably want to set a fetch size via @QueryParameters. The default at this time is 5k, see DEFAULT_FETCH_SIZE.
Upvotes: 6