// snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]
// snippet-sourcedescription:[UseDynamoMapping.java demonstrates how to use the DynamoDB mapping functionality]
// snippet-service:[dynamodb]
// snippet-keyword:[Java]
// snippet-keyword:[Amazon DynamoDB]
// snippet-keyword:[Code Sample]
// snippet-sourcetype:[full-example]
// snippet-sourcedate:[2019-12-16]
// snippet-sourceauthor:[scmacdon-AWS]

/*
   Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   This file is licensed under the Apache License, Version 2.0 (the "License").
   You may not use this file except in compliance with the License. A copy of
   the License is located at
    http://aws.amazon.com/apache2.0/
   This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
   CONDITIONS OF ANY KIND, either express or implied. See the License for the
   specific language governing permissions and limitations under the License.
*/

// snippet-start:[dynamodb.java.dynamoDB_mapping.complete]
package aws.example.dynamodb;

// snippet-start:[dynamodb.java.dynamoDB_mapping.import]
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBRangeKey;
import com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException;
// snippet-end:[dynamodb.java.dynamoDB_mapping.import]

public class UseDynamoMapping {

    public static void main(String[] args)
    {
        // snippet-start:[dynamodb.java.dynamoDB_mapping.main]
       AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard().build();
       MusicItems items = new MusicItems();

       try{
          //add new content to the Music table
           items.setArtist("Famous Band");
           items.setSongTitle("Our Famous Song");
           items.setAlbumTitle("Our First Album");
           items.setAwards(0);

           // Save the item.
           DynamoDBMapper mapper = new DynamoDBMapper(client);
           mapper.save(items);

            //Load an item based on the Partition Key and Sort Key
           //both values need to be passed to the mapper.load method
           String artist = "Famous Band";
           String songQueryTitle = "Our Famous Song";

           // Retrieve the item.
           MusicItems itemRetrieved = mapper.load(MusicItems.class, artist, songQueryTitle);
           System.out.println("Item retrieved:");
           System.out.println(itemRetrieved);

            //Modify the Award value
           itemRetrieved.setAwards(2);
           mapper.save(itemRetrieved);
           System.out.println("Item updated:");
           System.out.println(itemRetrieved);

           System.out.print("Done");
       }
       catch (AmazonDynamoDBException e)
       {
           e.getStackTrace();
       }
    }

    @DynamoDBTable(tableName="Music")
    public static class MusicItems {

        //Set up Data Members that correspond to columns in the Music table
        private String artist;
        private String songTitle;
        private String albumTitle;
        private int awards;

        @DynamoDBHashKey(attributeName="Artist")
        public String getArtist() { return this.artist; }
        public void setArtist(String artist) {this.artist = artist; }

        @DynamoDBRangeKey(attributeName="SongTitle")
        public String getSongTitle() { return this.songTitle; }
        public void setSongTitle(String title) {this.songTitle = title; }

        @DynamoDBAttribute(attributeName="AlbumTitle")
        public String getAlbumTitle() { return this.albumTitle; }
        public void setAlbumTitle(String title) {this.albumTitle = title; }

        @DynamoDBAttribute(attributeName="Awards")
        public int getAwards() { return this.awards; }
        public void setAwards(int awards) {this.awards = awards; }
    }
    // snippet-end:[dynamodb.java.dynamoDB_mapping.main]
}
// snippet-end:[dynamodb.java.dynamoDB_mapping.complete]

@@ -1806,24 +1806,527 @@
 args)%0A    %7B%0A
+        final String USAGE = %22%5Cn%22 +%0A                %22To run this example, supply the following values: %5Cn%22 +%0A                %22artist name %5Cn%22 +%0A                %22song title %5Cn%22 +%0A                %22album title %5Cn%22 +%0A                %22number of awards %5Cn%22;%0A%0A        if (args.length %3C 4) %7B%0A            System.out.println(USAGE);%0A            System.exit(1);%0A        %7D%0A%0A        String artist = args%5B0%5D;%0A        String songTitle = args%5B1%5D;%0A        String albumTitle = args%5B2%5D;%0A        String awards = args%5B3%5D;%0A%0A%0A
         // s
@@ -2524,17 +2524,18 @@
       //
-a
+ A
 dd new c
@@ -2587,29 +2587,22 @@
 tArtist(
-%22Famous Band%22
+artist
 );%0A     
@@ -2626,33 +2626,25 @@
 ngTitle(
-%22Our Famous Song%22
+songTitle
 );%0A     
@@ -2673,25 +2673,18 @@
 tle(
-%22Our First Album%22
+albumTitle
 );%0A 
@@ -2713,11 +2713,54 @@
 rds(
-0);
+Integer.parseInt(awards)); //convert to an int
 %0A%0A  
@@ -2776,33 +2776,32 @@
 // Save the item
-.
 %0A           Dyna
@@ -2894,16 +2894,17 @@
       //
+ 
 Load an 
@@ -2961,17 +2961,18 @@
       //
-b
+ B
 oth valu
@@ -3046,24 +3046,21 @@
 tist
- = %22Famous Band%22
+Name = artist
 ;%0A  
@@ -3096,25 +3096,17 @@
 e = 
-%22Our Famous Song%22
+songTitle
 ;%0A%0A 
@@ -3135,17 +3135,16 @@
 the item
-.
 %0A       
@@ -3210,16 +3210,20 @@
 , artist
+Name
 , songQu
@@ -3344,16 +3344,17 @@
       //
+ 
 Modify t

Update UseDynamoMapping.java