title: How can I retrieve all items from the paginated result of a DynamoDBMapper query()?
body: <p>I am trying to query DynamoDB with help of <a href="http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/JavaSDKHighLevel.html#JavaORMDynamoDBMapper">DynamoDBMapper</a> in Java with both hashKey and rangeKey. But I am not getting all results, it returns only some part of it. My code looks like:</p>
  
  <pre><code>queryDynamoDb() {
    Condition rangeKeyCondition = new Condition()
      .withComparisonOperator(ComparisonOperator.GT.toString())
      .withAttributeValueList(new AttributeValue().withS("0"));
  
      DynamoDBQueryExpression queryExpression = new DynamoDBQueryExpression(
              new AttributeValue().withS(prefKey));
  
      queryExpression.setRangeKeyCondition(rangeKeyCondition);
  
      List&lt;MyObj&gt; myobjs = mapper.query(MyObj.class, queryExpression);
      return myobjs;
  }
  </code></pre>
  
  <p><code>MyObj</code> is properly annotated with DynamoDB annotations. So I am able to save the objects, but retrieval returns a partial result only. </p>
  
  <p>The documentation of <em>query</em> within <a href="http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/JavaSDKHighLevel.html#JavaORMDynamoDBMapper">DynamoDBMapper</a> says: </p>
  
  <blockquote>
    <p>The query method returns the "lazy-loaded" collection. That is, initially it returns only one page of results. It makes a service call for the next page when needed. </p>
  </blockquote>
  
  <p>Now the question is, how to tell the mapper to make a service call or that a page is needed, so it loads all pages (effectively all entries)?</p>