Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8027123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:43:16+00:00 2026-06-04T23:43:16+00:00

I am trying to query DynamoDB with help of DynamoDBMapper in Java with both

  • 0

I am trying to query DynamoDB with help of DynamoDBMapper 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:

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<MyObj> myobjs = mapper.query(MyObj.class, queryExpression);
    return myobjs;
}

MyObj is properly annotated with DynamoDB annotations. So I am able to save the objects, but retrieval returns a partial result only.

The documentation of query within DynamoDBMapper says:

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.

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)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:43:19+00:00Added an answer on June 4, 2026 at 11:43 pm

    The Java code snippet within the Amazon DynamoDB documentation for the DynamoDBMapper Class is a bit unfortunate here (though technologically correct), the AWS SDK for Java API documentation for Class DynamoDBMapper is (naturally) more precise in this regard, see method query():

    public <T> PaginatedQueryList<T> query(Class<T> clazz,
                                           DynamoDBQueryExpression queryExpression)
    

    So the returned type is actually a Class PaginatedQueryList:

    Implementation of the List interface that represents the results from
    a query in AWS DynamoDB. Paginated results are loaded on demand when
    the user executes an operation that requires them. Some operations,
    such as size(), must fetch the entire list
    , but results are lazily
    fetched page by page when possible. [emphasize mine]

    That is, you really do not need to explicitly load anything during normal usage, insofar it is implicitly taken care of by the lazy-loading implementation of PaginatedQueryList<T>; however, if so desired for whatever reason, you can trigger it by operations requiring access to the entire collection, with the explicitly mentioned size() method being one of them apparently.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to query my database but for some reason I never get results
I'm trying to query an MySql table, put all results into a combobox. So
I'm trying to query XML through XPATH but is having problem getting id() to
I'm trying to query a MySQL database using an array but I'm having trouble!
I'm trying to query a database view that's not located on the same server
I am trying to query an .xls spreadsheet with VBScript, but I have run
I'm trying to query a table, fetch all records, and save the result as
I am trying to query from a temp table and i keep getting this
Im trying to query a List but unable to get the result the way
I`m trying to query all task lists. I have modified default Task content type

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.