Skip to content

Instantly share code, notes, and snippets.

@richardgrantserverless
Created April 11, 2022 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richardgrantserverless/7b190c8ff4e8e474a2fadf9cb70f566a to your computer and use it in GitHub Desktop.
Save richardgrantserverless/7b190c8ff4e8e474a2fadf9cb70f566a to your computer and use it in GitHub Desktop.
package com.serverless.dal;
...
@DynamoDBTable(tableName = "PLACEHOLDER_PRODUCTS_TABLE_NAME")
public class Product {
private static final String PRODUCTS_TABLE_NAME = System.getenv("PRODUCTS_TABLE_NAME");
...
private String id;
private String name;
private Float price;
@DynamoDBHashKey(attributeName = "id")
@DynamoDBAutoGeneratedKey
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
@DynamoDBRangeKey(attributeName = "name")
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@DynamoDBAttribute(attributeName = "price")
public Float getPrice() {
return this.price;
}
public void setPrice(Float price) {
this.price = price;
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment