You should use @DynamoDBTyped(DynamoDBAttributeType.BOOL) instead of @DynamoDBNativeBoolean. Please see the example below.
I was using aws-java-sdk-dynamodb:1.11.293
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-dynamodb</artifactId>
<version>1.11.293</version>
</dependency>
and the following Entity
@DynamoDBTable(tableName = "Test")
public static class Entity {
private String id;
private boolean value;
public Entity() {
}
public Entity(String id, boolean value) {
this.id = id;
this.value = value;
}
@DynamoDBHashKey(attributeName = "id")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@DynamoDBTyped(DynamoDBAttributeType.BOOL)
@DynamoDBAttribute(attributeName = "value")
public boolean isValue() {
return value;
}
public void setValue(boolean value) {
this.value = value;
}
}
and main method
public static void main(String[] args) {
AmazonDynamoDB dynamoDB = AmazonDynamoDBClientBuilder.standard()
.withRegion(Regions.US_EAST_1)
.withCredentials(new AWSStaticCredentialsProvider(
new BasicAWSCredentials("accessKey", "secretKey")))
.build();
DynamoDBMapper mapper = new DynamoDBMapper(dynamoDB);
mapper.save(new Entity("id", true));
Entity entity = mapper.load(Entity.class, "id");
System.out.println(entity.getId() + " " + entity.isValue());
}