title: How to query DynamoDB using ONLY Partition Key [Java]?
body: <p>I am new to DynamoDB and wanted to know how can we query on a table in DynamoDB by using ONLY partition key in JAVA</p>
  <p>I have table called &quot;ervive-pdi-data-invalid-qa&quot; and it's Schema is :</p>
  <ol>
  <li>partition key is &quot;SubmissionId&quot;</li>
  <li>Sort key is &quot;Id&quot;.</li>
  <li>City (Attribute)</li>
  <li>Errors (Attribute)</li>
  </ol>
  <p>The table looks like this:
  <a href="https://i.stack.imgur.com/Zw5Wa.png" rel="nofollow noreferrer">Table</a></p>
  <p>I want to retrieve the sort key value and remaining attributes data by using Partition key using  (software.amazon.awssdk) new version of AWS SDK DynamoDB classes.</p>
  <p>is it possible to get it? If so, can any one post the answers?</p>
  <p>Have tried this:</p>
  <pre><code>       DynamoDbClient ddb = 
             DynamoDbClient.builder().region(Region.US_EAST_1).build();
               DynamoDbEnhancedClient enhancedClient = 
                  DynamoDbEnhancedClient.builder()
                  .dynamoDbClient(ddb)
                  .build();
  
          //Define table
          DynamoDbTable&lt;ErvivePdiDataInvalidQa&gt; table = 
             enhancedClient.table(&quot;ervive-pdi-data-invalid-qa&quot;,
                    TableSchema.fromBean(ErvivePdiDataInvalidQa.class));
  
          Key key = Key.builder().partitionValue(2023).build();
          ErvivePdiDataInvalidQa result = table.getItem(r-&gt;r.key(key));
          System.out.println(&quot;The record id is &quot;+result.getId());
  </code></pre>
  <p>ErvivePdiDataInvalidQa table class is in below comment*</p>
  <p>and it is returning &quot;<strong>The provided key element does not match the schema (Service: DynamoDb, Status Code: 400, Request ID: PE1MKPMQ9MLT51OLJQVDCURQGBVV4KQNSO5AEMVJF66Q9ASUAAJG, Extended Request ID: null)</strong>&quot;</p>